pyinstapaper package

Submodules

pyinstapaper.instapaper module

class pyinstapaper.instapaper.Bookmark(client, **data)[source]

Bases: pyinstapaper.instapaper.InstapaperObject

Object representing an Instapaper bookmark/article.

ATTRIBUTES = ['bookmark_id', 'title', 'description', 'hash', 'url', 'progress_timestamp', 'time', 'progress', 'starred', 'type', 'private_source']
RESOURCE = 'bookmarks'
RESOURCE_ID_ATTRIBUTE = 'bookmark_id'
SIMPLE_ACTIONS = ['delete', 'star', 'archive', 'unarchive', 'get_text']
TIMESTAMP_ATTRS = ['progress_timestamp', 'time']
get_highlights()[source]

Get highlights for Bookmark instance.

Returns:list of Highlight objects
Return type:list
class pyinstapaper.instapaper.Folder(client, **data)[source]

Bases: pyinstapaper.instapaper.InstapaperObject

Object representing an Instapaper folder.

ATTRIBUTES = ['folder_id', 'title', 'display_title', 'sync_to_mobile', 'folder_id', 'position', 'type', 'slug']
RESOURCE = 'folders'
RESOURCE_ID_ATTRIBUTE = 'folder_id'
SIMPLE_ACTIONS = ['delete']
set_order(folder_ids)[source]

Order the user’s folders

Parameters:folders (list) – List of folder IDs in the desired order.
Returns:List Folder objects in the new order.
Return type:list
class pyinstapaper.instapaper.Highlight(client, **data)[source]

Bases: pyinstapaper.instapaper.InstapaperObject

Object representing an Instapaper highlight.

ATTRIBUTES = ['highlight_id', 'text', 'note', 'time', 'position', 'bookmark_id', 'type', 'slug']
RESOURCE = 'highlights'
RESOURCE_ID_ATTRIBUTE = 'highlight_id'
SIMPLE_ACTIONS = ['delete']
TIMESTAMP_ATTRS = ['time']
create()[source]
class pyinstapaper.instapaper.Instapaper(oauth_key, oauth_secret)[source]

Bases: object

Instapaper client class.

Parameters:
  • str (oauth_secret) – Instapaper OAuth consumer key
  • str – Instapaper OAuth consumer secret
get_bookmarks(folder='unread', limit=25, have=None)[source]

Return list of user’s bookmarks.

Parameters:
  • folder (str) – Optional. Possible values are unread (default), starred, archive, or a folder_id value.
  • limit (int) – Optional. A number between 1 and 500, default 25.
  • have (list) – Optional. A list of IDs to exclude from results
Returns:

List of user’s bookmarks

Return type:

list

get_folders()[source]

Return list of user’s folders.

Return type:list
login(username, password)[source]

Authenticate using XAuth variant of OAuth.

Parameters:
  • username (str) – Username or email address for the relevant account
  • password (str) – Password for the account
request(path, params=None, returns_json=True, method='POST', api_version='1')[source]

Process a request using the OAuth client’s request method.

Parameters:
  • path (str) – Path fragment to the API endpoint, e.g. “resource/ID”
  • params (dict) – Parameters to pass to request
  • method (str) – Optional HTTP method, normally POST for Instapaper
  • api_version (str) – Optional alternative API version
Returns:

response headers and body

Retval:

dict

class pyinstapaper.instapaper.InstapaperObject(client, **data)[source]

Bases: object

Base class for Instapaper objects like Bookmark.

Parameters:
  • client (oauth2.Client) – instance of the OAuth client for making requests
  • data (dict) – key/value pairs of object attributes, e.g. title, etc.
add()[source]

Save an object to Instapaper after instantiating it.

Example:

folder = Folder(instapaper, title='stuff')
result = folder.add()

Module contents

Top-level package for PyInstapaper.