sevenbridges.http package


sevenbridges.http.client module

class sevenbridges.http.client.AAHeader[source]

Bases: object

key = 'X-Sbg-Advance-Access'
value = 'Advance'
class sevenbridges.http.client.HttpClient(url=None, token=None, oauth_token=None, config=None, timeout=None, proxies=None, error_handlers=None, advance_access=False, pool_connections=None, pool_maxsize=None, pool_block=True, max_parallel_requests=None, retry_count=None, backoff_factor=None)[source]

Bases: object

Implementation of all low-level API stuff, creating and sending requests, returning raw responses, authorization, etc.

delete(url, headers=None, params=None, append_base=True)[source]
get(url, headers=None, params=None, data=None, append_base=True, stream=False)[source]
patch(url, headers=None, params=None, data=None, append_base=True)[source]
post(url, headers=None, params=None, data=None, append_base=True)[source]
put(url, headers=None, params=None, data=None, append_base=True)[source]
class sevenbridges.http.client.RequestSession[source]

Bases: requests.sessions.Session

Client session class

send(request, **kwargs)[source]

Send prepared request :param request: Prepared request to be sent :param kwargs: request keyword arguments :return: Request response

sevenbridges.http.client.config_vars(profiles, advance_access)[source]

Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return:

sevenbridges.http.client.generate_session(pool_connections, pool_maxsize, pool_block, proxies=None, retry_count=None, backoff_factor=None)[source]

Utility method to generate request sessions. :param pool_connections: The number of urllib3 connection pools to

  • pool_maxsize – The maximum number of connections to save in the pool.
  • pool_block – Whether the connection pool should block for connections.
  • proxies – Proxies dictionary.
  • retry_count – Number of retries to attempt
  • backoff_factor – Backoff factor for retries

requests.Session object.


sevenbridges.http.error_handlers module

sevenbridges.http.error_handlers.general_error_sleeper(api, response, sleep=300)[source]

Pauses the execution if response status code is > 500. :param api: Api instance. :param response: requests.Response object :param sleep: Time to sleep in between the requests.

sevenbridges.http.error_handlers.maintenance_sleeper(api, response, sleep=300)[source]

Pauses the execution if sevenbridges api is under maintenance. :param api: Api instance. :param response: requests.Response object. :param sleep: Time to sleep in between the requests.

sevenbridges.http.error_handlers.rate_limit_sleeper(api, response)[source]

Pauses the execution if rate limit is breached. :param api: Api instance. :param response: requests.Response object


Marks ‘repeatable’ error handlers. Error handler is repeatable if propagate input response in case of no error handling occurred.