Client¶
-
class
nineapi.client.
Client
(app_id='com.ninegag.android.app', log_level=20)[source]¶ 9GAG API Client.
Create API client instance.
Parameters: - app_id – Application id (defaults to ‘com.ninegag.android.app’)
- log_level – Logging level (defaults to logging.INFO)
-
get_posts
(group=1, type_='hot', count=10, entry_types=['animated', 'photo', 'video', 'album'], olderThan=None, **kwargs)[source]¶ Fetch posts.
Parameters: - group – Posts category (defaults to 1)
- type – Posts type (defaults to ‘hot’)
- count – Count of posts.
- entry_types – list of strings
- olderThan – Last seen post (for pagination) - str,
Post
or None
Returns: list of
Post
Raises: APIException
Authorization status.
-
log_in
(username, password)[source]¶ Attempt to log in.
Parameters: - username – User login.
- password – User password.
Returns: True
Return type: bool
Raises: APIException
-
search_posts_by_tag
(query, offset=0, count=10, entry_types=['animated', 'photo', 'video', 'album'], sort='asc', **kwargs)[source]¶ Fetch posts that match specific tag.
Parameters: - query – Posts tag
- offset – Offset to start from.
- count – Count of posts.
- entry_types – list of strings
- sort – sorting order (“asc” or “desc”) - does not seem to work
Returns: list of
Post
Raises: APIException