Developer Docs¶
This section of the documentation is for other developers, and contains the complete information about each package, module, class, and method.
Submodules¶
mention.base module¶
-
class
mention.base.
AppDataAPI
(access_token)[source]¶ Bases:
mention.base.Mention
Retrieves useful details about the application.
Parameters: access_token (str) – Mention API access_token -
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
-
class
mention.base.
CreateAnAlertAPI
(access_token, account_id, name, queryd, languages, countries=None, sources=None, blocked_sites=None, noise_detection=None, reviews_pages=None)[source]¶ Bases:
mention.base.Mention
Retrieve details about a single alert.
Parameters: - access_token – Mention API access_token
- account_id – ID of the account.
- name – Alert name.
- queryd – queryd is a dictionary that can be of two different types: basic or advanced.
Example: >>> 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)' }
Parameters: - languages (list) – A list of language codes. eg: [‘en’].
- countries (list) – A list of country codes. eg: [‘US’, ‘RU’, ‘XX’].
- sources (list) –
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) – A list of blocked sites from which you don’t want mentions to be tracked.
- noise_detection (boolean) – Enables noise detection.
- reviews_pages (list) – List of reviews pages.
-
data
¶ - Parameters passed to the API containing the details to create a new
- alert.
Returns: parameters to create new alert. Return type: dict
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
CurateAMentionAPI
(access_token, account_id, alert_id, mention_id, favorite=None, trashed=None, read=None, tags=None, folder=None, tone=None)[source]¶ Bases:
mention.base.Mention
Updates an existing mention.
Parameters: - access_token (str) – Mention API access_token
- account_id (str) – ID of the account.
- alert_id (str) – ID of the alert.
- mention_id (str) – ID of the mention.
- favorite (boolean) – Boolean value indicating if the mention was set as favorite.
- trashed (boolean) – Boolean value indicating if the mention has been put in trash.
- read (str) – Boolean value indicating that a mention was read.
- tags (dict) – add list of tags attributed to the mention.
- folder (str) – Indicates the folder where the mention has been put.
- tone (str) – Tone value given to the mention. Must be one of ‘negative’, ‘neutral’, ‘positive’.
-
data
¶ - Parameters passed to the API containing the details to update a
- alert.
Returns: parameters to create new alert. Return type: dict
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
FetchAMentionAPI
(access_token, account_id, alert_id, mention_id)[source]¶ Bases:
mention.base.Mention
Get a single mention by its mention ID.
Parameters: - access_token (str) – Mention API access_token
- account_id (str) – ID of the account.
- alert_id (str) – ID of the alert.
- mention_id (str) – ID of the mention.
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
FetchAlertsAPI
(access_token, account_id)[source]¶ Bases:
mention.base.Mention
This method will allow you to fetch a list of all alerts for a given account.
Parameters: - access_token (str) – Mention API access_token
- account_id (str) – ID of the account.
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
FetchAllMentionsAPI
(access_token, account_id, alert_id, since_id=None, limit='20', before_date=None, not_before_date=None, 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)[source]¶ Bases:
mention.base.Mention
Get all or a filtered amount of mentions from an account.
Parameters: - access_token – Mention API access_token
- account_id – ID of the account.
- alert_id – ID of the alert.
- since_id – Returns mentions ordered by id. Can not be combined with before_date, not_before_date, cursor.
- limit – Number of mentions to return. max 1000.
- before_date – Mentions Before date in ‘yyyy-MM-dd HH:mm’ format
Example: >>> before_date = '2018-11-25 12:00'
Parameters: - not_before_date (str) – Mentions Not before date in ‘yyyy-MM-dd HH:mm’ format
- source (str) – 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 (str) – Filter by folder. Can be: inbox, archive, spam, trash. With spam and trash, include_children is enabled by default.
- tone (str) – Filter by tone. Must be one of ‘negative’, ‘neutral’, ‘positive’.
- countries (str) – Filter by country.
- include_children (boolean) – include children mentions.
- sort (str) – Sort results. Must be one of published_at, author_influence.score, direct_reach, cumulative_reach, domain_reach.
- languages (str) – Filter by language.
- timezone (str) – Filter by timezone.
- q (str) – Filter by q.
- cursor (str) – Filter by cursor
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
FetchAnAlertAPI
(access_token, account_id, alert_id)[source]¶ Bases:
mention.base.Mention
Retrieve details about a single alert.
Parameters: - access_token (str) – Mention API access_token
- account_id (str) – ID of the account.
- alert_id (str) – ID of the alert.
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
FetchMentionChildrenAPI
(access_token, account_id, alert_id, mention_id, limit=None, before_date=None)[source]¶ Bases:
mention.base.Mention
“”This class will allow you to fetch a list of all children mentions for a given mention.
Parameters: - access_token – Mention API access_token
- account_id – ID of the account.
- alert_id – ID of the alert.
- limit – Number of mentions to return. max 1000.
- before_date – Mentions Before date in ‘yyyy-MM-dd HH:mm’ format
Example: >>> before_date = '2018-11-25 12:00'
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
MarkAllMentionsAsReadAPI
(access_token, account_id, alert_id)[source]¶ Bases:
mention.base.Mention
Marks all mentions as read.
Parameters: - access_token (str) – Mention API access_token
- account_id (str) – ID of the account.
- alert_id (str) – ID of the alert.
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
-
class
mention.base.
Mention
(access_token)[source]¶ Bases:
object
The base class for all of the Mention API calls.
Parameters: access_token (str) – Mention API access_token
-
class
mention.base.
UpdateAnAlertAPI
(access_token, account_id, alert_id, name, queryd, languages, countries=None, sources=None, blocked_sites=None, noise_detection=None, reviews_pages=None)[source]¶ Bases:
mention.base.Mention
Modifies an existing alert, usually to update the criteria and to improve the search’s efficiency.
Parameters: - access_token – Mention API access_token
- account_id – ID of the account.
- name – Alert name.
- queryd – Queryd is a dictionary that can be of two different types: basic or advanced.
Example: >>> 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)' }
Parameters: - languages (list) – A list of language codes. eg: [‘en’].
- countries (list) – A list of country codes. eg: [‘US’, ‘RU’, ‘XX’].
- sources (list) –
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) – A list of blocked sites from which you don’t want mentions to be tracked.
- noise_detection (boolean) – Enables noise detection.
- reviews_pages (list) – List of reviews pages.
-
data
¶ - Parameters passed to the API containing the details to update a
- alert.
Returns: parameters to create new alert. Return type: dict
-
params
¶ Parameters used in the url of the API call and for authentication.
Returns: parameters used in the url. Return type: dict
-
query
()[source]¶ The request that returns a JSON file of the API call given a url.
Returns: the base_url and the end_url. Return type: class: json
-
url
¶ The concatenation of the base_url and end_url that make up the resultant url.
Returns: the base_url and the end_url. Return type: str
mention..utils module¶
-
mention.utils.
transform_boolean
(value)[source]¶ Transfroms boolean to 1 or 0.
Parameters: value (boolean) – Boolean value. Returns: number representation of boolean 1 or 0. Return type: str