示例#1
0
    def __init__(self,
                 access_token,
                 account_id,
                 alert_id,
                 mention_id,
                 favorite=None,
                 trashed=None,
                 read=None,
                 tags=None,
                 folder=None,
                 tone=None):
        self.access_token = access_token
        self.account_id = account_id
        self.alert_id = alert_id
        self.mention_id = mention_id

        if favorite is not None:
            self.favorite = utils.transform_boolean(favorite)
        else:
            self.favorite = favorite

        if trashed is not None:
            self.trashed = utils.transform_boolean(trashed)
        else:
            self.trashed = trashed

        if read is not None:
            self.read = tone = utils.transform_tone(read)
        else:
            self.read = read

        self.tags = tags
        self.folder = folder
        self.tone = tone
        super(CurateAMentionAPI, self).__init__(access_token)
示例#2
0
    def __init__(self,
                 access_token,
                 account_id,
                 alert_id,
                 name,
                 queryd,
                 languages,
                 countries=None,
                 sources=None,
                 blocked_sites=None,
                 noise_detection=None,
                 reviews_pages=None):
        self.access_token = access_token
        self.account_id = account_id
        self.alert_id = alert_id
        self.name = name
        self.queryd = queryd
        self.languages = languages
        self.countries = countries
        self.sources = sources
        self.blocked_sites = blocked_sites

        if noise_detection is not None:
            self.noise_detection = utils.transform_boolean(noise_detection)
        else:
            self.noise_detection = noise_detection

        self.reviews_pages = reviews_pages
        super(UpdateAnAlertAPI, self).__init__(access_token)
示例#3
0
    def __init__(
            self,
            access_token,
            account_id,
            alert_id,
            since_id=None,
            limit='20',
            before_date=None,  # 2018-07-07T00:00:00.12345+02:00
            not_before_date=None,  # #2018-07-01T00:00:00.12345+02:00
            source=None,
            unread=None,
            favorite=None,
            folder=None,
            tone=None,
            countries=None,
            include_children=None,
            sort=None,
            languages=None,
            timezone=None,
            q=None,
            cursor=None):
        self.access_token = access_token
        self.account_id = account_id
        self.alert_id = alert_id

        self.limit = limit

        self.since_id = since_id

        if before_date is not None:
            self.before_date = utils.transform_date(before_date)
        else:
            self.before_date = before_date

        if not_before_date is not None:
            self.not_before_date = utils.transform_date(not_before_date)
        else:
            self.not_before_date = not_before_date

        self.source = source

        if unread is not None:
            self.unread = utils.transform_boolean(unread)
        else:
            self.unread = unread

        if favorite is not None:
            self.favorite = utils.transform_boolean(favorite)
        else:
            self.favorite = favorite

        self.folder = folder

        if tone is not None:
            self.tone = tone = utils.transform_tone(tone)
        else:
            self.tone = tone

        self.countries = countries

        if include_children is not None:
            self.include_children = utils.transform_boolean(include_children)
        else:
            self.include_children = include_children

        self.sort = sort
        self.languages = languages
        self.timezone = timezone
        self.q = q
        self.cursor = cursor
        super(FetchAllMentionsAPI, self).__init__(access_token)
示例#4
0
    def __init__(
            self,
            access_token,
            account_id,
            alert_id,
            since_id=None,
            limit='20',
            before_date=None,  # 2018-07-07T00:00:00.12345+02:00
            not_before_date=None,  # #2018-07-01T00:00:00.12345+02:00
            source=None,
            unread=None,
            favorite=None,
            folder=None,
            tone=None,
            countries=None,
            include_children=None,
            sort=None,
            languages=None,
            timezone=None,
            q=None,
            cursor=None):
        """
        Parameters
        ----------
        access_token: string
            Mention API access_token

        alert_id: string
            ID of the alert.

        since_id: string
            Returns mentions ordered by id
            Can not be combined with before_date, not_before_date, cursor.

        limit: string
            Number of mentions to return. max 1000.

        before_date: string
            Mentions Before date in 'yyyy-MM-dd HH:mm' format
            eg. '2018-11-25 12:00'

        not_before_date: string
            Mentions Not before date in 'yyyy-MM-dd HH:mm' format
            eg. '2018-10-04 12:00'

        source: string
            Must be either web, twitter, blogs, forums, news, facebook, images or videos

        unread: boolean
            return only unread mentions.
            Must not be combined with favorite, q, and tone.

        favorite: boolean
            Whether to return only favorite mentions.
            Can not be combined with folder, when folder is not inbox or archive

        folder: string
            Filter by folder. Can be: inbox, archive, spam, trash.
            With spam and trash, include_children is enabled by default.

        tone: string
            Filter by tone. Must be one of 'negative', 'neutral', 'positive'

        countries: string
            Filter by country

        include_children: boolean
            include children mentions.

        sort: string
            Sort results. Must be one of published_at, author_influence.score,
            direct_reach, cumulative_reach, domain_reach.

        languages: string
            Filter by language

        timezone: string
            Filter by timezone

        q: string
            Filter by q

        cursor: string
            Filter by cursor
        """
        self.access_token = access_token
        self.account_id = account_id
        self.alert_id = alert_id

        self.limit = limit

        self.since_id = since_id

        if before_date is not None:
            self.before_date = utils.transform_date(before_date)
        else:
            self.before_date = before_date

        if not_before_date is not None:
            self.not_before_date = utils.transform_date(not_before_date)
        else:
            self.not_before_date = not_before_date

        self.source = source

        if unread is not None:
            self.unread = utils.transform_boolean(unread)
        else:
            self.unread = unread

        if favorite is not None:
            self.favorite = utils.transform_boolean(favorite)
        else:
            self.favorite = favorite

        self.folder = folder

        if tone is not None:
            self.tone = tone = utils.transform_tone(tone)
        else:
            self.tone = tone

        self.countries = countries

        if include_children is not None:
            self.include_children = utils.transform_boolean(include_children)
        else:
            self.include_children = include_children

        self.sort = sort
        self.languages = languages
        self.timezone = timezone
        self.q = q
        self.cursor = cursor
        super(FetchAllMentionsAPI, self).__init__(access_token)
示例#5
0
    def __init__(self,
                 access_token,
                 account_id,
                 alert_id,
                 name,
                 queryd,
                 languages,
                 countries=None,
                 sources=None,
                 blocked_sites=None,
                 noise_detection=None,
                 reviews_pages=None):
        """
        Parameters
        ----------
        access_token: string
            Mention API access_token

        account_id: string
            ID of the account.

        alert_id: string
            ID of the alert.

        name: string
            Alert name.

        queryd: dict
            Queryd is a dictionary that can be of two different types: basic or
            advanced.
            
            eg.
            queryd = {
                'type'='basic',
                'included_keywords' : ["NASA", "Arianespace", "SpaceX", "Pockocmoc"],
                'required_keywords' : ["mars"],
                'excluded_keywords' : ["nose", "fil d'ariane"],
                'monitored_website' : ["domain":"www.nasa.gov", "block_self":true]
            }

            OR

            queryd = {
                'type' : 'advanced',
                'query_string' : '(NASA AND Discovery) OR (Arianespace AND Ariane)'
            }
            
        languages: list [str]
            A list of language codes. eg: ['en']

        countries: list [str]
            A list of country codes. eg: ['US', 'RU', 'XX']

        sources: list [str]
            A list of sources from which mentions should be tracked.
            Must be either web, twitter, blogs, forums, news, facebook, images or videos

        blocked_sites: list [str] 
            A list of blocked sites from which you don't want mentions to be tracked.

        noise_detection: boolean
            Enables noise detection.

        reviews_pages: list [str]  
            List of reviews pages.

        """
        self.access_token = access_token
        self.account_id = account_id
        self.alert_id = alert_id
        self.name = name
        self.queryd = queryd
        self.languages = languages
        self.countries = countries
        self.sources = sources
        self.blocked_sites = blocked_sites

        if noise_detection is not None:
            self.noise_detection = utils.transform_boolean(noise_detection)
        else:
            self.noise_detection = noise_detection

        self.reviews_pages = reviews_pages
        super(UpdateAnAlertAPI, self).__init__(access_token)