Skip to main content

PUBQ Python SDK

Project description

PUBQ Python SDK

PUBQ is a pub/sub channels cloud and this is the official Python client library including both real-time and REST interfaces.

To meet PUBQ and see more info and examples, please read the documentation.

Getting Started

Follow these steps to just start building with PUBQ in Python or see the Quickstart guide which covers more programming languages.

Install with package manager

The Python SDK is available as PyPI package:

pip install pubq

Interacting with PUBQ

Get your application id and key from PUBQ dashboard by creating a new app or use existing one.

Connect to PUBQ:

import asyncio
from pubq.realtime import RealTime

def onConnect(socket):
    print("Connected to PUBQ!")

async def main():

    realtime = RealTime("YOUR_API_KEY")
    realtime.emitter.add_listener("connect", onConnect)

asyncio.run(main())

Subscribe a channel and listen for any data publish to receive::

realtime.subscribe('my-channel', onChannelMessage)

def onChannelMessage(channel, data):
    print("Received new data: '" + str(data))

Publish a message with REST interface:

from pubq.rest import REST

if __name__ == "__main__":
    rest = REST("YOUR_API_KEY");
    rest.publish("my-channel", "Hello!");

Development

Please, read the contribution guide.

Setup

git clone git@github.com:pubqio/pubq-python.git
cd ./pubq-python/
poetry install

Tests

To run tests using pytest:

poetry run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pubq-1.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pubq-1.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pubq-1.1.0.tar.gz.

File metadata

  • Download URL: pubq-1.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/21.6.0

File hashes

Hashes for pubq-1.1.0.tar.gz
Algorithm Hash digest
SHA256 44e8b35ef50691b24e1720d54c533f19c58931eaffb93e6992d0d4533499fbdf
MD5 d411ca5c1d7971e67415817cf2491c25
BLAKE2b-256 dc966dcf283a11a670c2138f09a924b31a89824f96bbd597513a7c81cab5acc9

See more details on using hashes here.

File details

Details for the file pubq-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pubq-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/21.6.0

File hashes

Hashes for pubq-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62a4c2fc65b5a1a08c1cd30e97f8364860b3184200d23db52bfd9fe0cd083fdb
MD5 2078e7384784528c89454ccba840e46c
BLAKE2b-256 fd02ca0bf082d16975f69513315c41e742f35ddc1c21cbb0ba6fecd08216c073

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page