If an app or website doesn’t meet Goole's security standards, Google might block anyone who’s trying to sign in to your account from it. So, SMTPAuthenticationError exception thrown when you attempt to login to Gmail via Python smtp library. Less secure apps can make it easier for hackers to get in to your account, so blocking sign-ins from these apps helps keep your account safe.
Go to this link and select Turn On
https://www.google.com/settings/security/lesssecureapps
Moreover google block an ip when you try to send a email since a unusual location, so, you can unblock in the next link
https://support.google.com/accounts/answer/6009563
and clicked in
accounts.google.com/DisplayUnlockCaptcha .