How to use the pyreferrer.referrer.Referrer.USER_AGENT_SUBSTRINGS function in pyreferrer

To help you get started, we’ve selected a few pyreferrer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Shopify / pyreferrer / pyreferrer / referrer.py View on Github external
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
github Shopify / pyreferrer / pyreferrer / referrer.py View on Github external
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