virgil_sdk.client.connections package

Submodules

virgil_sdk.client.connections.base_connection module

class virgil_sdk.client.connections.base_connection.BaseConnection[source]

Bases: object

A connection for making HTTP requests against URI endpoints.

base_url

Base address for the connection.

send(request)[source]

Sends an HTTP request to the API.

Parameters:request – The HTTP request details.

virgil_sdk.client.connections.base_request module

class virgil_sdk.client.connections.base_request.BaseRequest[source]

Bases: object

Represent a generic HTTP request.

body

Gets the requests body.

endpoint

Gets the endpoint. Does not include server base address.

headers

Gets the http headers.

method

Gets the request method.

virgil_sdk.client.connections.request module

class virgil_sdk.client.connections.request.Request(endpoint, body=None, method='GET', headers=None)[source]

Bases: virgil_sdk.client.connections.base_request.BaseRequest

Http request wrapper.

Parameters:
  • endpoint – request endpoint
  • body – request body
  • headers – dict of request additional headers
  • method – http request method
DELETE = 'DELETE'
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
authorization(access_token)[source]

Add authorization token to request.

Parameters:access_token – Service access token.
body

Gets the requests body.

endpoint

Gets the endpoint. Does not include server base address

headers

Gets the http headers.

method

Gets the request method.

virgil_sdk.client.connections.service_connection module

class virgil_sdk.client.connections.service_connection.ServiceConnection(base_url)[source]

Bases: virgil_sdk.client.connections.base_connection.BaseConnection

base_url

Gets api url.

send(request)[source]

Sends an HTTP request to the API.

Parameters:

request – The HTTP request details.

Returns:

Response.

Raises:
  • ClientException – Gets some connection or api errors.
  • UnauthorizedClientException – Request without or wrong access token.

virgil_sdk.client.connections.service_error module

exception virgil_sdk.client.connections.service_error.ServiceError[source]

Bases: Exception

virgil_sdk.client.connections.urllib module

Module containing urllib importing logic for version compatibility.

class virgil_sdk.client.connections.urllib.RequestWithMethod(*args, **kwargs)[source]

Bases: urllib.request.Request, object

urllib-compatible Request class containing request method

get_method()[source]

Get http method

Module contents