How to use the pyreferrer.referrer.Referrer.google_search_type 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
if known_url:
                referrer['label'] = known_url['label']
                referrer['type'] = known_url['type']
                referrer['query'] = Referrer.parse_query_string(url, known_url.get('parameters'))
        elif user_agent_info['registered_domain']:
            known_url = rules.get(user_agent_info['registered_domain'])

            if known_url:
                referrer['label'] = known_url['label']
                referrer['type'] = known_url['type']
                referrer['query'] = Referrer.parse_query_string(url, known_url.get('parameters'))
        else:
            referrer['type'] = Referrer.Types.INVALID if raw_url else Referrer.Types.DIRECT

        referrer['google_search_type'] = Referrer.google_search_type(referrer['type'], referrer['label'], referrer['path'])

        return referrer