cannabis_reports.request_paginator package

Module contents

class cannabis_reports.request_paginator.RequestPaginator(endpoint, data=None, output_type=<type 'dict'>, request_type='get', session=None, iteration_limit=None)[source]

Bases: object

RequestPaginator provides an iterator based upon an initial request.

DELETE = 'delete'
GET = 'get'
PAGE_CURRENT = 'current_page'
PAGE_DATA = 'data'
PAGE_TOTAL = 'total_pages'
POST = 'post'
PUT = 'put'
SSL_VERIFY = True
call(data=None)[source]

Generic API caller. Return the JSON decoded result.

Parameters:data (dict, optional) – Either the request parameters or the JSON data, depending on the request type.
Returns:JSON decoded response.
Return type:mixed
delete(json=None)[source]

Send a DELETE request and return the JSON decoded result.

Parameters:json (dict, optional) – Object to encode and send in request.
Returns:JSON decoded response data.
Return type:mixed
get(params=None)[source]

Send a POST request and return the JSON decoded result.

Parameters:params (dict, optional) – Mapping of parameters to send in request.
Returns:JSON decoded response data.
Return type:mixed
page_current = 0
page_total = 0
post(json=None)[source]

Send a POST request and return the JSON decoded result.

Parameters:json (dict, optional) – Object to encode and send in request.
Returns:JSON decoded response data.
Return type:mixed
put(json=None)[source]

Send a PUT request and return the JSON decoded result.

Parameters:json (dict, optional) – Object to encode and send in request.
Returns:JSON decoded response data.
Return type:mixed