canvas_data package

canvas_data.api module

class canvas_data.api.CanvasDataAPI(api_key, api_secret, download_chunk_size=1048576)[source]

Bases: object

download_files(account_id='self', dump_id=None, table_name=None, download_directory='./downloads', include_requests=True, force=False)[source]

Download all of the files for a specific dump, all of the files for a specific table, or the files for a specific table from a specific dump.

get_data_for_dump(dump_id='latest', account_id='self', data_directory='./data', download_directory='./downloads', include_requests=False, force=False)[source]

Decompresses and concatenates the dump files for all of the tables in a particular dump.

get_data_for_table(table_name, account_id='self', dump_id='latest', data_directory='./data', download_directory='./downloads', force=False)[source]

Decompresses and concatenates the dump files for a particular table and writes the resulting data to a text file. If a sequence parameter is passed in, the output filename will be prefixed with the sequence.

get_dumps(account_id='self', limit=100, after_sequence=None)[source]

Get a list of all dumps

get_file(file, download_directory='./downloads', force=False)[source]
get_file_urls(account_id='self', **kwargs)[source]

Get a list of file URLs, either by dump_id (or latest) or by table_name.

get_latest_regular_dump(account_id='self')[source]

Finds the latest dump_id that isn’t a full requests dump.

get_schema(version='latest', key_on_tablenames=False)[source]

Get a particular version of the schema. Note that the keys in the returned data structure are usually, but not always, the same as the table names. If you’d rather have the keys in the returned data structure always exactly match the table names, set key_on_tablenames=True

get_schema_versions()[source]

Get the list of all available schema versions.

get_sync_file_urls(account_id='self')[source]

Get a list of file URLs that constitute a complete snapshot of the current data

canvas_data.api.retry(func)[source]

File download retry decorator

canvas_data.exceptions module

exception canvas_data.exceptions.APIConnectionError(msg=None)[source]

Bases: canvas_data.exceptions.CanvasDataAPIError

Raised when the underlying HTTP request fails

exception canvas_data.exceptions.CanvasDataAPIError(msg=None)[source]

Bases: exceptions.Exception

Basic Canvas Data API errors

exception canvas_data.exceptions.MissingCredentialsError(msg=None)[source]

Bases: canvas_data.exceptions.CanvasDataAPIError

Raised when either the api_key or api_secret is missing

canvas_data.hmac_auth module

class canvas_data.hmac_auth.CanvasDataHMACAuth(api_key, api_secret, api_root='https://api.inshosteddata.com')[source]

Bases: requests.auth.AuthBase

Attaches HMAC Authentication to the given Request object.