archivebox.vendor package
Submodules
archivebox.vendor.base32_crockford module
base32-crockford
A Python module implementing the alternate base32 encoding as described by Douglas Crockford at: http://www.crockford.com/wrmg/base32.html.
He designed the encoding to:
Be human and machine readable
Be compact
Be error resistant
Be pronounceable
It uses a symbol set of 10 digits and 22 letters, excluding I, L O and U. Decoding is not case sensitive, and ‘i’ and ‘l’ are converted to ‘1’ and ‘o’ is converted to ‘0’. Encoding uses only upper-case characters.
Hyphens may be present in symbol strings to improve readability, and are removed when decoding.
A check symbol can be appended to a symbol string to detect errors within the string.
- archivebox.vendor.base32_crockford.encode(number, checksum=False, split=0)[source]
Encode an integer into a symbol string.
A ValueError is raised on invalid input.
If checksum is set to True, a check symbol will be calculated and appended to the string.
If split is specified, the string will be divided into clusters of that size separated by hyphens.
The encoded string is returned.
- archivebox.vendor.base32_crockford.decode(symbol_string, checksum=False, strict=False)[source]
Decode an encoded symbol string.
If checksum is set to True, the string is assumed to have a trailing check symbol which will be validated. If the checksum validation fails, a ValueError is raised.
If strict is set to True, a ValueError is raised if the normalization step requires changes to the string.
The decoded string is returned.
- archivebox.vendor.base32_crockford.normalize(symbol_string, strict=False)[source]
Normalize an encoded symbol string.
Normalization provides error correction and prepares the string for decoding. These transformations are applied:
Hyphens are removed
‘I’, ‘i’, ‘L’ or ‘l’ are converted to ‘1’
‘O’ or ‘o’ are converted to ‘0’
All characters are converted to uppercase
A TypeError is raised if an invalid string type is provided.
A ValueError is raised if the normalized string contains invalid characters.
If the strict parameter is set to True, a ValueError is raised if any of the above transformations are applied.
The normalized string is returned.
archivebox.vendor.pocket module
- exception archivebox.vendor.pocket.PocketException[source]
Bases:
Exception
Base class for all pocket exceptions http://getpocket.com/developer/docs/errors
- exception archivebox.vendor.pocket.InvalidQueryException[source]
Bases:
PocketException
- exception archivebox.vendor.pocket.AuthException[source]
Bases:
PocketException
- exception archivebox.vendor.pocket.RateLimitException[source]
Bases:
PocketException
- exception archivebox.vendor.pocket.ServerMaintenanceException[source]
Bases:
PocketException
- class archivebox.vendor.pocket.Pocket(consumer_key, access_token)[source]
Bases:
object
This class implements a basic python wrapper around the pocket api. For a detailed documentation of the methods and what they do please refer the official pocket api documentation at http://getpocket.com/developer/docs/overview
- api_endpoints = {'add': 'https://getpocket.com/v3/add', 'get': 'https://getpocket.com/v3/get', 'send': 'https://getpocket.com/v3/send'}
- statuses = {200: 'Request was successful', 400: 'Invalid request, please make sure you follow the documentation for proper syntax', 401: 'Problem authenticating the user', 403: 'User was authenticated, but access denied due to lack of permission or rate limiting', 503: "Pocket's sync server is down for scheduled maintenance."}
- add(url, title=None, tags=None, tweet_id=None)[source]
This method allows you to add a page to a user’s list. In order to use the /v3/add endpoint, your consumer key must have the “Add” permission. http://getpocket.com/developer/docs/v3/add
- get(state=None, favorite=None, tag=None, contentType=None, sort=None, detailType=None, search=None, domain=None, since=None, count=None, offset=None)[source]
This method allows you to retrieve a user’s list. It supports retrieving items changed since a specific time to allow for syncing. http://getpocket.com/developer/docs/v3/retrieve
- send(actions)[source]
This method allows you to make changes to a user’s list. It supports adding new pages, marking pages as read, changing titles, or updating tags. Multiple changes to items can be made in one request. http://getpocket.com/developer/docs/v3/modify
- bulk_add(item_id, ref_id=None, tags=None, time=None, title=None, url=None, wait=True)[source]
Add a new item to the user’s list http://getpocket.com/developer/docs/v3/modify#action_add
- archive(item_id, time=None, wait=True)[source]
Move an item to the user’s archive http://getpocket.com/developer/docs/v3/modify#action_archive
- readd(item_id, time=None, wait=True)[source]
Re-add (unarchive) an item to the user’s list http://getpocket.com/developer/docs/v3/modify#action_readd
- favorite(item_id, time=None, wait=True)[source]
Mark an item as a favorite http://getpocket.com/developer/docs/v3/modify#action_favorite
- unfavorite(item_id, time=None, wait=True)[source]
Remove an item from the user’s favorites http://getpocket.com/developer/docs/v3/modify#action_unfavorite
- delete(item_id, time=None, wait=True)[source]
Permanently remove an item from the user’s account http://getpocket.com/developer/docs/v3/modify#action_delete
- tags_add(item_id, tags, time=None, wait=True)[source]
Add one or more tags to an item http://getpocket.com/developer/docs/v3/modify#action_tags_add
- tags_remove(item_id, tags, time=None, wait=True)[source]
Remove one or more tags from an item http://getpocket.com/developer/docs/v3/modify#action_tags_remove
- tags_replace(item_id, tags, time=None, wait=True)[source]
Replace all of the tags for an item with one or more provided tags http://getpocket.com/developer/docs/v3/modify#action_tags_replace
- tags_clear(item_id, time=None, wait=True)[source]
Remove all tags from an item. http://getpocket.com/developer/docs/v3/modify#action_tags_clear
- tag_rename(item_id, old_tag, new_tag, time=None, wait=True)[source]
Rename a tag. This affects all items with this tag. http://getpocket.com/developer/docs/v3/modify#action_tag_rename
- commit()[source]
This method executes the bulk query, flushes stored queries and returns the response
- classmethod get_request_token(consumer_key, redirect_uri='http://example.com/', state=None)[source]
Returns the request token that can be used to fetch the access token
- classmethod get_credentials(consumer_key, code)[source]
Fetches access token from using the request token and consumer key
- classmethod auth(consumer_key, redirect_uri='http://example.com/', state=None)[source]
This is a test method for verifying if oauth worked http://getpocket.com/developer/docs/authentication
archivebox.vendor.taggit_utils module
- archivebox.vendor.taggit_utils.split_strip(string, delimiter=',')[source]
Splits
string
ondelimiter
, stripping each resulting string and returning a list of non-empty strings.Ported from Jonathan Buchanan’s django-tagging