scoopy.client¶
-
class
scoopy.client.ScoopItAPI(consumer_key, consumer_secret)¶ Main class to access the Scoop.it API.
-
compilation(since, count)¶ Get a compilation of followed topics of the current user. Posts are ordered by date.
Parameters: - since (
scoopy.datatypes.Timestamp.) – Only retrieve posts newer than this. - count (int.) – Maximum amount of posts to retrieve.
Returns: iterator –
scoopy.datatypes.Postobjects.- since (
-
get_oauth_access_token(token_verifier)¶ Ask the API server for an oauth access_token.
Parameters: token_verifier (str.) – The code returned by the access_token url. Returns: None.
-
get_oauth_access_token_url(callback_url)¶ Generate an access authorization URL.
Parameters: callback_url (str.) – The url to which the user should be redirected. Returns: str – The url to authorize the application.
-
get_oauth_request_token()¶ Ask the API server for an oauth request_token.
Returns: None
-
load_oauth_token(filepath)¶ Load a previously saved OAuth token.
Parameters: filepath (str.) – Path to the file containing the token. Returns: None.
-
notifications(since=None)¶ Notifications for the current user.
Parameters: since ( scoopy.datatypes.Timestampor None.) – Only get notifications newer than this.Returns: iterator – scoopy.datatypes.Notificationobjects.
-
post(post_id)¶ Access a post data.
Parameters: post_id (int.) – The ID of the post. Returns: a scoopy.datatypes.Postobject.
-
profile(profile_id=None, curated=None, curable=None)¶ Access a user’s profile.
Parameters: - profile_id (int or None.) – Profile owner’s ID (defaults to the current user).
- curated (int or None.) – Numer of curated posts to retrieve for each topic (defaults to 0).
- curable – Number of curable posts to retrieve for each topic where the user is curator (defaults to 0).
Returns: An
scoopy.datatypes.Userobject.
-
request(url, params, method='GET')¶ Make a request to an API end-point, request will be signed using the current OAuth token.
Parameters: - url (str.) – The end-point url.
- params (dict.) – Parameters to pass to the request.
- method (str.) – The HTTP method used to perform the request.
Returns: dict – Data returned by the server.
-
resolve(entity, short_name)¶ Resolve an object (topic or user) given its short name.
Parameters: - entity (str.) – The type of entity to resolve (‘user’ or ‘topic’).
- short_name (str.) – The short name to resolve.
Returns: str – The ID corresponding to the given short name.
-
save_oauth_token(filepath)¶ Save the current OAuth token to a file.
Parameters: filepath (str.) – Path to the file where the token should be saved. Returns: None.
-
topic(topic_id, curated=None, curable=None, order=None, tag=None, since=None)¶ Access a topic data (list of posts, statistics).
Parameters: - topic_id (int or None.) – The topic’s ID.
- curated (int or None.) – Number of curated posts to retrieve from the topic (defaults to 30).
- curable (int or None.) – Number of curable posts to retrieve from the topic (defaults to 30).
- order (str.) – Sort order of curated posts, can be ‘tag’, ‘curationDate’, or ‘user’ (mandatory if ‘since’ parameter isn’t specified).
- tag (str.) – Tag used to filter results (mandatory if ‘order’ is ‘tag’).
- since (
scoopy.datatypes.Timestamp.) – Only retrieve curated posts newer than this.
Returns: tuple – (
scoopy.datatypes.Topic,scoopy.datatypes.TopicStats)
-