readycloud package

Submodules

readycloud.decorators module

readycloud.decorators

Module with decorators

readycloud.decorators.safe_json_request(func)[source]

Decorator which check response returned by func, and:

  • If status 20x or 40x - returns json deserialized response
  • If status 50x - raises ReadyCloudServerError

readycloud.exceptions module

exception readycloud.exceptions.ReadyCloudServerError(*args, **kwargs)[source]

Bases: requests.exceptions.HTTPError

readycloud.readycloud module

readycloud.readycloud

Module which contains ReadyCloud class.

class readycloud.readycloud.ReadyCloud(token, host='https://readycloud.com/')[source]

Bases: object

Class for working with ReadyCloud API.

Parameters:
  • token (str) – your bearer token
  • host (str) – host with which you want to work (readycloud.com by default)
create_order(order)[source]

Create a new order.

Parameters:order (dict) – dict structure of order
Returns:dict – dictionary with response
create_orders_webhook(url)[source]

Create new webhook for orders.

Parameters:url (str) – Url to which RS should post updated for orders
Returns:dict – dictionary with response
create_webhook(entity, url)[source]

Create new webhook.

Parameters:
  • entity (str) – Entity for which you want to register webhook
  • url (str) – Url to which RC should post updates for registered entity
Returns:

dict – dictionary with response

delete(*args, **kwargs)[source]

Do DELETE request to ReadyCloud.

Parameters:url (str) – url to which you want to do request
Returns:dict – dictionary with response
delete_order(order_id)[source]

Delete order

Parameters:order_id (int) – order id for delete
Returns:dict – dictionary with response
delete_webhook(webhook_id)[source]

Delete webhook

Parameters:webhook_id (int) – webhook id for delete
Returns:dict – dictionary with response
get(*args, **kwargs)[source]

Do GET request to ReadyCloud.

Parameters:
  • url (str) – url to which you want to do request
  • params (dict) – dict with request params
Returns:

dict – dictionary with response

get_headers()[source]

Get http headers for request.

Returns:dict – dictionary with headers
get_order_url(order_id)[source]

Get orders endpoint url for specified order_id

Parameters:order_id (int) – order id
Returns:str – absolute url to order endpoint
get_orders(**kwargs)[source]

Get orders.

Parameters:**kwargs

filters, limit, offset, etc.

Returns:dict – dictionary with response
get_orders_url()[source]

Get orders endpoint url.

Returns:str – absolute url to orders endpoint
get_webhook_url(webhook_id)[source]

Get webhoojs endpoint url for specified webhook_id

Parameters:webhook_id (int) – webhook id
Returns:str – absolute url to webhook endpoint
get_webhooks(**kwargs)[source]

Get list of registered webhooks

Returns:dict – dictionary with response
get_webhooks_url()[source]

Get webhooks endpoint url.

Returns:str – absolute url to webhooks endpoint
post(*args, **kwargs)[source]

Do POST request to ReadyCloud.

Parameters:
  • url (str) – url to which you want to do request
  • data (dict) – dict with POST data
Returns:

dict – dictionary with response

put(*args, **kwargs)[source]

Do PUT request to ReadyCloud.

Parameters:
  • url (str) – url to which you want to do request
  • data (dict) – dict with data which you want to PUT
Returns:

dict – dictionary with response

update_order(order_id, order)[source]

Update an existing order.

Parameters:
  • order_id (int) – order id
  • order (dict) – dict structure of order
Returns:

dict – dictionary with response

update_orders_webhook(webhook_id, url)[source]

Update url for already registered orders webhook.

Parameters:
  • webhook_id (int) – webhook id which you want to edit
  • url (str) – new webhook url
Returns:

dict – dictionary with response

update_webhook(webhook_id, entity, url)[source]

Update an existing webhook.

Parameters:
  • webhook_id (int) – order id
  • entity (str) – Entity for which you want to register webhook
  • url (str) – Url to which RC should post updates for registered entity
Returns:

dict – dictionary with response

readycloud.utils module

readycloud.utils

Module which contains different utils, helpers, etc.

readycloud.utils.get_response_json(response)[source]

Safe loads JSON response. If response is not json serialized - return it as content key.

Parameters:response (requests response object) – response
Returns:dict – dictionary with loaded json response
readycloud.utils.urljoin(*args)[source]

Join provided url parts to url

Parameters:*args

url parts to join

Returns:str – concatenated url

Module contents

readycloud.readycloud

Module which exposes public api.