Python Brewer API

Brewer API is provided as a notion of an interface with implementation details provided for specific negotiated pubkeeper protocol.

Client API

__init__(topic, crypto=True, brewer_id=None)

topic—The topic to be published to
crypto—Should the brewed data be encrypted
brewer_id—If set, use this as the brewer's ID rather than generating one

Creating a brewer is simple: it's an object with a topic to be produced. When adding this brewer object to the client, it will inherit all the brews available to the client for use.

configure():

Called when connected to a pubkeeper server. Allows the protocol implementation to create cipher keys, or any other setup necessary.

get_config()

This method returns any brewer-specific configuration that is needed for registration. This may include cryptographic information that patrons will need to decrypt brewed data.

new_patrons(patrons)

patrons—List of patrons that are to be subscribed to our brewed data

List element format

patron_id—UUID of patron that is subscribing to us
brew—Brew method of consuming our data

Called when a patron_notify packet is received from the server with the ID and brew of the newly connected patrons.

remove_patron(patron_id)

patron_id—Patron ID of a removed patron

Called when a patron_removed packet is received from the server with the ID of the disconnected patron.

reset()

Called when disconnected from a pubkeeper server, to cleanup any protocol specific data associated to this brewer

brew(data)

data—The data to be published

This is where you send data to be published in this brewer's topic. The data must be bytes format.

results matching ""

    No results matching ""