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-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

pubq-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pubq-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 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-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3e38faa92a894fce2ea626999c589a97cfefbcd38ec3eeb4e5815bf96c1a4d64
MD5 06f2c165e3a0ddcb178f24bf0467982e
BLAKE2b-256 e8c104bdd935e137d85bf246430c0e980be8c7866514fa8e183074cffb0b531e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pubq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6759f1fd14911731ea9013c18407b881528218e54a68cf21e2624ac886cca058
MD5 1041a723612e10a07e9ff17ab71d9f23
BLAKE2b-256 508f966b9163eafe6879157b8592c5979d83cafdd68638b2b0e51a3c18111cf0

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