Python Forum

Full Version: Allow to Login if there is no IP Address
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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”,
}
)
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?