bovine.clients.signed_http
SignedHttpClient
Client for using HTTP Signatures
Source code in bovine/bovine/clients/signed_http.py
__init__
__init__(
session: ClientSession,
public_key_url: str,
private_key: str,
digest_method: (
Callable[[bytes], Tuple[str, str]] | None
) = None,
)
Creates the http client. By using content_digest_sha256_rfc_9530 one can send the Content Digest according to RFC 9530.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
ClientSession
|
The aiohttp.ClientSession |
required |
public_key_url
|
str
|
Used as keyId when signing |
required |
private_key
|
str
|
The pem encoded private key |
required |
digest_method
|
Callable[[bytes], Tuple[str, str]] | None
|
Allow specifying the method used to compute the digest |
None
|
Source code in bovine/bovine/clients/signed_http.py
event_source
event_source(url: str)
Opens an event source to url
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Url to query |
required |
get
async
get(url: str, headers: dict = {}) -> ClientResponse
post
async
Posts to url using a signed post request
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
URL to post to |
required |
body
|
str
|
The post body |
required |
headers
|
dict
|
extra headers |
{}
|
content_type
|
str
|
Content type of the message |
None
|
Source code in bovine/bovine/clients/signed_http.py
legacy_digest_method
Digest method with sha-256 as prefix