Python Forum
Allow to Login if there is no IP Address - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Allow to Login if there is no IP Address (/thread-27594.html)



Allow to Login if there is no IP Address - venkat1425 - Jun-12-2020

I Am new to Phyton coding, and i have question like, user will allow to login if there is no IP address found.

please find below and let me know is there any changes required and where..?

def get_location_object(ip_address):
 Try:
 Return GeoLite2IPLocation(ip_address=ip_address)
 except IpAddressLocationNotFound:
 Return  FreeGeoIPLocation(ip_address=ip_address)


 location = get_location_object(ip_address=self.ip_address)
 Logger.info(
{
 “login_credentials”: login_crendtials,
 “is_valid_user”: True if self.account else false,
“Country”: location.country,
“Description”: “LOGIN”,
}
)



RE: Allow to Login if there is no IP Address - micseydel - Jun-12-2020

What's stopping you? I'm not familiar with the libraries it looks like you're using. Is your question about using them, or something outside of them?