hellosign_sdk.utils package

Submodules

hellosign_sdk.utils.exception module

exception hellosign_sdk.utils.exception.BadGateway(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Bad gateway

exception hellosign_sdk.utils.exception.BadRequest(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Bad request data

exception hellosign_sdk.utils.exception.Conflict(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Request correctly formulated but unable to proceed due to a conflict

exception hellosign_sdk.utils.exception.Forbidden(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Not authorized to proceed

exception hellosign_sdk.utils.exception.GatewayTimeout(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Gateway timeout

exception hellosign_sdk.utils.exception.Gone(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Resource deleted

exception hellosign_sdk.utils.exception.HSException(message)

Bases: exceptions.Exception

General HelloSign exception

We use this object to raise exceptions when none of its child classes is suitable for use.

exception hellosign_sdk.utils.exception.HTTPError(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HSException

General HTTP error

exception hellosign_sdk.utils.exception.InternalServerError(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Server error

exception hellosign_sdk.utils.exception.MethodNotAllowed(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

HTTP method not supported

exception hellosign_sdk.utils.exception.MethodNotImplemented(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Not implemented

exception hellosign_sdk.utils.exception.NoAuthMethod(message)

Bases: hellosign_sdk.utils.exception.HSException

No authentication data

exception hellosign_sdk.utils.exception.NotAcceptable(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Accept header conflicts with the returned resource type

exception hellosign_sdk.utils.exception.NotFound(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Resource not found

exception hellosign_sdk.utils.exception.PaymentRequired(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Payment/upgrade required to proceed

exception hellosign_sdk.utils.exception.RequestTimeout(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Request timeout

exception hellosign_sdk.utils.exception.RequestURITooLong(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Request URI too long

exception hellosign_sdk.utils.exception.RequestedRangeNotSatisfiable(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Invalid resource data chunk requested

exception hellosign_sdk.utils.exception.ServiceUnavailable(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Service unavailable

exception hellosign_sdk.utils.exception.Unauthorized(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Bad authentication data

exception hellosign_sdk.utils.exception.UnsupportedMediaType(message, http_code=None)

Bases: hellosign_sdk.utils.exception.HTTPError

Unsupported media type

hellosign_sdk.utils.hsaccesstokenauth module

class hellosign_sdk.utils.hsaccesstokenauth.HSAccessTokenAuth(access_token, access_token_type, refresh_token=None, expires_in=None, state=None)

Bases: requests.auth.AuthBase

Authentication object using HelloSign’s access token

classmethod from_response(response_data)

Builds a new HSAccessTokenAuth straight from response data

Args:
response_data (dict): Response data to use
Returns:
A HSAccessTokenAuth objet

hellosign_sdk.utils.request module

class hellosign_sdk.utils.request.HSRequest(auth, env='production')

Bases: object

Object to handle HTTP requests

Although we have greate requests package which can handle the HTTP request beautifully, we need this class to fit better our need like sending the requests with authentication information, download files, check HTTP errors...

Attributes:
DEFAULT_ENCODING (str): Default encoding for requests USER_AGENT (str): HTTP User agent used when sending requests parameters (dict): Some parameters for GET requests headers (dict): Custome headers for every requests http_status_code (int): HTTP status code returned of requests
DEFAULT_ENCODING = 'UTF-8'
USER_AGENT = 'hellosign-python-sdk'
get(url, headers=None, parameters=None, get_json=True)

Send a GET request with custome headers and parameters

Args:
url (str): URL to send the request to headers (str, optional): custom headers parameters (str, optional): optional parameters
Returns:
A JSON object of the returned response if get_json is True, Requests’ response object otherwise
get_file(url, path_or_file=None, headers=None, filename=None)

Get a file from a url and save it as filename

Args:

url (str): URL to send the request to

path_or_file (str or file): A writable File-like object or a path to save the file to.

filename (str): [DEPRECATED] File name to save the file as, this can be either
a full path or a relative path

headers (str, optional): custom headers

Returns:
True if file is downloaded and written successfully, False otherwise.
get_warnings()

Return the list of warnings associated with this request, or None if there aren’t any

headers = None
http_status_code = 0
parameters = None
post(url, data=None, files=None, headers=None, get_json=True)

Make POST request to a url

Args:
url (str): URL to send the request to data (dict, optional): Data to send files (dict, optional): Files to send with the request headers (str, optional): custom headers
Returns:
A JSON object of the returned response if get_json is True, Requests’ response object otherwise
response_callback = None
verify_ssl = True
warnings = None

hellosign_sdk.utils.utils module

Module contents

class hellosign_sdk.utils.api_resource(obj_cls)

Decorator that transforms response data into a Resource

class hellosign_sdk.utils.api_resource_list(obj_cls)

Bases: hellosign_sdk.utils.api_resource

Decorator that transforms response data into a ResourceList