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/', org_id=None, api='v2')[source]

Bases: object

Class for working with ReadyCloud API.

API_V1 = 'v1'
API_V2 = 'v2'
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 (str) – 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 (str) – order id
Returns:str – absolute URL to order endpoint
get_orders(**kwargs)[source]

Get orders.

Parameters:kwargs (dict) – 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_organization(org_id)[source]

Get organization. :param str org_id: hexahexacontadecimal encoded organization id :returns: dict – dictionary with response

get_organization_url(org_id)[source]

Get organization endpoint URL :param str org_id: hexahexacontadecimal encoded organization id :returns: str – absolute URL to organization endpoint

get_organizations(**kwargs)[source]

Get organization. :param dict kwargs: filters, limit, offset, etc. :returns: dict – dictionary with response

get_organizations_url()[source]

Get organizations endpoint URL :returns: str – absolute URL to organizations endpoint

get_webhook_url(webhook_id)[source]

Get webhooks 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 :param dict kwargs: filters, limit, offset, etc.

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

Get webhooks endpoint URL.

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

Do PATCH 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

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 (str) – 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.