bovine.clients

This module contains functionality outside of the scope of ActivityPub, but useful in the FediVerse.

async bovine.clients.fetch_nodeinfo(session: ClientSession, domain: str) dict | None[source]

Fetches the nodeinfo 2.0 object from domain using the /.well-known/nodeinfo endpoint

async bovine.clients.lookup_account_with_webfinger(session: ClientSession, fediverse_handle: str) str | None[source]

Deprecated: Use lookup_uri_with_webfinger instead

Looks up the actor url associated with a FediVerse handle, i.e. an identifier of the form username@domain, using the webfinger endpoint

Parameters:
  • session – the aiohttp.ClientSession to use

  • fediverse_handle – the FediVerse handle as a string

async bovine.clients.lookup_did_with_webfinger(session: ClientSession, domain: str, did: str)[source]

Deprecated: Use lookup_uri_with_webfinger instead

Looks up the actor url associated with a did and domain using the webfinger endpoint

Parameters:
  • session – the aiohttp.ClientSession to use

  • domain – the domain to perform the lookup from

  • did – the did key to perform lookup with

async bovine.clients.lookup_uri_with_webfinger(session: ClientSession, uri: str, domain: str | None = None) Tuple[str | None, bool | None][source]

Looks up an actor URI associated with an URI and domain using the webfinger endpoint following fep-4adb

Parameters:
  • session – the aiohttp.ClientSession to use

  • uri – the uri to perform lookup with

  • domain – the domain to perform the lookup from

Returns:

A tuple of (actor URI, verification_necessary). The value of verification_necessary indicates that it is necessary if the actor has the appropriate authority to associate the query URI with itself.

async bovine.clients.lookup_with_dns(session: ClientSession, domain: str) str | None[source]

Looks up the actor url associated with the dns entry for domain. See FEP-612d: Identifying ActivityPub Objects through DNS for the mechanism.

Parameters:
  • session – the aiohttp.ClientSession to use

  • domain – the domain to perform the lookup from

class bovine.clients.moo_auth.MooAuthClient(session, did_key, private_key)[source]

Client for using Moo-Auth-1 authentication

class bovine.clients.signed_http.SignedHttpClient(session, public_key_url, private_key, account_url=None)[source]

Client for using HTTP Signatures

async get(url, headers={}) ClientResponse[source]

Retrieves url using a signed get request

async post(url, body, headers={}, content_type=None)[source]

Posts to url using a signed post request

class bovine.clients.bearer.BearerAuthClient(session: ClientSession, bearer_key: str)[source]

Client for using Bearer authentication

event_source(url: str, headers: dict = {}) EventSource[source]

Returns an EventSource for the server sent events given by url