Skip to main content

No project description provided

Project description

Direct Connect Client Library for Python

Run tests

docker compose run test

Linting is black/isort/mypy/flake8 and those can be run locally as appropriate.

Usage

Import and create a client.

from direct_connect import nmdc

client = nmdc.NMDC(host="example.com", nick="my_bot", socket_timeout=2.0)

Send a message.

await msg = await client.send_chat("test chat")

Get a message.

await msg = await client.get_message()

Note this is 'blocking' in the sense that messages are not being retrieved if get_message() is not being awaited. It may make sense to build a worker pattern in your application with a task continually checking for messages.

Messages are returned as dictionaries with user and message keys.

>>> msg
{"user": "my_bot", "message": "test chat"}

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

direct_connect-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

direct_connect-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: direct_connect-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for direct_connect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d85d748fb48ae75f30ae7df079ae895679bf097ac488390f0da8ac2aa20edb0
MD5 6ed60cfb62605a5f2d944d9799c6b3e0
BLAKE2b-256 830394274be9fa19744c26690e580ffc89ff462e60744b0265b0f0510bb8b7bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for direct_connect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 239c519db2af58db081dbb829a8cfa711b95ad4bb33451bc7c5804c8b03b12aa
MD5 e5555ab64cabf5b47701cc76de1f58ae
BLAKE2b-256 2c26204b304f50dd841a55b2e3661c4fff3cc00d4f8501ee0133642de44579e1

See more details on using hashes here.

Supported by

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