helpscout.request_paginator package

Module contents

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

Bases: object

RequestPaginator provides an iterator based upon an initial request.

DELETE = 'delete'
GET = 'get'
PAGE_CURRENT = 'page'
PAGE_DATA_MULTI = 'items'
PAGE_DATA_SINGLE = 'item'
PAGE_SIZE = 50
PAGE_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.
Raises:NotImplementedError – In the event that an invalid request type was defined.
Returns:JSON decoded respons.
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