Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extract_user_agent_info(user_agent):
empty_info = {'domain': '', 'url': '', 'tld': '', 'registered_domain': ''}
if user_agent is None:
return empty_info
for substrings, domain_info in Referrer.USER_AGENT_SUBSTRINGS:
if any(substring in user_agent for substring in substrings):
return domain_info
return empty_info
def extract_user_agent_info(user_agent):
empty_info = {'domain': '', 'url': '', 'tld': '', 'registered_domain': ''}
if user_agent is None:
return empty_info
for substrings, domain_info in Referrer.USER_AGENT_SUBSTRINGS:
if any(substring in user_agent for substring in substrings):
return domain_info
return empty_info