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
Release history Release notifications | RSS feed
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.1.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for direct_connect-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f6c8ee4f1c0305e921ff2d2c870cdabaed44ddacd78c08158d2cc1ee6d2c22 |
|
MD5 | 69f10072d6bb704b54c31e7e36324839 |
|
BLAKE2b-256 | 2311b3a5f1c795acea1bd22a50c303e56e7f0c9260284baeee67e82ec68b3efa |