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_APPLICATION_ID", "YOUR_APPLICATION_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_APPLICATION_ID",
        "YOUR_APPLICATION_KEY",
        "YOUR_APPLICATION_SECRET"
    );

    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.0.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.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pubq-1.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 5376a78a4a561160149df1fc36cec59d318a9949c1ed6c9b322f9094213bea1c
MD5 4881b2cc72a6e946858d90abd91d7a48
BLAKE2b-256 cb35941be130e55b08648cf69c15296d59738e712dfb952c80be09d4b770c5b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pubq-1.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 752826f2b0004276e51eb134ddb03892fe6888a1a559e3742bf76818697e72c2
MD5 3432d966952d721ecfe842f9f4aefb28
BLAKE2b-256 7bafab6852c40f101780b134cabdd9d18e564b22271d8f8ad66422126220a6d9

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