Skip to main content
# Pubkeeper Python Client

The Pubkeeper Python Client enables you to connect to a Pubkeeper Server instance, and to participate in the production and subscription of data topics.

## Quick Start

### Install From Wheels
#### Acquire

Since pubkeeper source is currently closed to a small subset of individuals, the quickest way to install Pubkeeper Python Client is from a set of wheel files. Wheels are located in s3 under the Pubkeeper bucket. For Pubkeeper Python Client you will need at least four wheels `pubkeeper-protocol`, `pubkeeper-communication`, `pubkeeper-communication-websocket`, and `pubkeeper-client` are all required. The individual brew wheels are the pieces that enable the communication over a given protocol. The three currently supported, and available, wheels are `pubkeeper-brew-zmq`, `pubkeeper-brew-websocket`, and `pubkeeper-brew-local`.

#### Install

Into your environment install the wheel files together:

```
pip install pubkeeper-protocol*.whl pubkeeper-comunication*.whl pubkeeper-client*.whl pubkeeper-brew*.whl
```

### Install From Source
#### Clone the repo

If you have access to the Pubkeeper project you may install directly from source for development purposes.

```
git clone git@github.com:pubkeeper/python-client
```

#### Install

Ensure the protocol, and communicaiton wheels are installed into your environment before installing the Pubkeeper Python Client and Brews. Then you can install Pubkeeper Python Client and Brews into your own virtualenv.

```
pip3 install -e /path/to/where/you/cloned/python-client
```

### Using the Pubkeeper Python Client
#### Authentication Tokens

Pubkeeper Server handles client authentication with JWT. As such you will need to acquire a token from the server you are going to be connecting to.

#### Running

In the most basic example, we will connect to the Pubkeeper Server, and register a single Brewer and publish a string. Note that the client sits upon a Tornado IOLoop, as such it runs inside of its own thread, and will need to be gracefilly shutdown when your program ends. This example assumes you are running an unsecured Pubkeeper Server, and Websocket Server on your localhost. You will need to replace these with actual values.

```py
from pubkeeper.client import PubkeeperClient
from pubkeeper.brewer import Brewer
from pubkeeper.communication.websocket import WebsocketClientCommunication
from pubkeeper.brew.websocket.brew import WebsocketBrew
from time import sleep

server_comm = WebsocketClientCommunication({
'host': 'localhost',
'port': 9898,
'secure': False
})
client = PubkeeperClient(jwt='your-auth-token', server_comm=server_comm)

websocket_brew = WebsocketBrew()
websocket_brew.configure({
'ws_host': 'localhost',
'ws_port': 8000,
'ws_secure': False
})

client.add_brew(websocket_brew)
client.start_brews()

try:
brewer = Brewer('demo.topic')
client.add_brewer(brewer)

while True:
brewer.brew(b'data')
time.sleep(1)
except KeyboardInterrupt:
client.shutdown()
```

## Complete Documentation

A more complete documentation of the Pubkeeper Python Client, and Pubkeeper System may be found at: [docs.pubkeeper.com](http://docs.pubkeeper.com)


Metadata

Release files for pubkeeper.client 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pubkeeper.client 0.2.2
File Interpreter ABI Platform
pubkeeper.client-0.2.2-py3-none-any.whl Python 3 none any Details

Release files / pubkeeper.client-0.2.2-py3-none-any.whl

Download URL pubkeeper.client-0.2.2-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a680248642875d01039e654d3dbca55ed0cef1d44b54d33fd07c503e178d1010
BLAKE2b-256 checksum
How to use checksums
68f14c53385fa70d2155ce8ecc85fd4b087e8899987322485f3eb2017bfb76f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

This release

0.2.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page