How to use the pyreferrer.referrer.Referrer.Types.INVALID 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
class Types:
        INVALID  = 'invalid'
        INDIRECT = 'indirect'
        DIRECT   = 'direct'
        SEARCH   = 'search'
        SOCIAL   = 'social'
        EMAIL    = 'email'

    USER_AGENT_SUBSTRINGS = [
            (['Twitter'],          {'tld': 'com', 'domain': 'twitter', 'url': 'twitter://twitter.com', 'registered_domain': 'twitter.com'}),
            (['Pinterest'],        {'tld': 'com', 'domain': 'pinterest', 'url': 'pinterest://pinterest.com', 'registered_domain': 'pinterest.com'}),
            (['FBAV', 'Facebook'], {'tld': 'com', 'domain': 'facebook', 'url': 'facebook://facebook.com', 'registered_domain': 'facebook.com'}),
    ]

    BLANK_REFERRER = {
        'type': Types.INVALID,
        'url': '',
        'subdomain': '',
        'domain': '',
        'label': '',
        'tld': '',
        'path': '',
        'query': ''
    }

    rules = Ruleset().rules

    @staticmethod
    def parse_query_string(url, parameters):
        if not parameters:
            return ''
github Shopify / pyreferrer / pyreferrer / referrer.py View on Github external
INVALID = 'invalid'
        INDIRECT = 'indirect'
        DIRECT = 'direct'
        SEARCH = 'search'
        SOCIAL = 'social'
        EMAIL = 'email'

    USER_AGENT_SUBSTRINGS = [
        (['Twitter'], {'tld': 'com', 'domain': 'twitter', 'url': 'twitter://twitter.com', 'registered_domain': 'twitter.com'}),
        (['Pinterest'], {'tld': 'com', 'domain': 'pinterest', 'url': 'pinterest://pinterest.com', 'registered_domain': 'pinterest.com'}),
        (['FBAV', 'Facebook', 'FBAN', 'FB_IAB'], {'tld': 'com', 'domain': 'facebook', 'url': 'facebook://facebook.com', 'registered_domain': 'facebook.com'}),
        (['Instagram'], {'tld': 'com', 'domain': 'instagram', 'url': 'instagram://instagram.com', 'registered_domain': 'instagram.com'}),
    ]

    BLANK_REFERRER = {
        'type': Types.INVALID,
        'url': '',
        'subdomain': '',
        'domain': '',
        'label': '',
        'tld': '',
        'path': '',
        'query': ''
    }

    rules = Ruleset().rules

    @staticmethod
    def parse_query_string(url, parameters):
        if not parameters:
            return ''