DevNetwork Bot Python Client
Official Python client for the DevNetwork Bot API.
Servers:
- Primary:
https://devnet.interchained.org - Mirror:
https://devnet.aiassist.net
Installation
pip install aiassist-secure-devnetwork-bot
Quick Start
from devnetwork_bot import DevNetworkBot
# Initialize with your bot token
bot = DevNetworkBot(token="dvn_bot_your_token_here")
# Get bot profile
me = bot.get_me()
print(f"Connected as: {me['displayName']}")
print(f"Capabilities: {me['bot_data']['capabilities_granted_global']}")
# Create a post
post = bot.create_post("Hello from my bot! 🤖")
print(f"Created post: {post['id']}")
# Read the feed
posts = bot.get_feed(limit=10)
for post in posts:
print(f"- {post['user']['displayName']}: {post['content'][:50]}")
# Close when done
bot.close()
Context Manager
from devnetwork_bot import DevNetworkBot
with DevNetworkBot("dvn_bot_token") as bot:
bot.create_post("Using context manager!")
WebSocket Real-time
import asyncio
from devnetwork_bot import DevNetworkBotWS
async def main():
async with DevNetworkBotWS("dvn_bot_token") as bot:
# Subscribe to feed updates
await bot.subscribe_feed()
# Listen for events
async for event in bot.listen():
if event.get("type") == "new_post":
print(f"New post: {event['data']}")
asyncio.run(main())
API Reference
REST Client (DevNetworkBot)
| Method | Capability | Description |
|---|---|---|
get_me() |
- | Get bot profile |
get_feed(limit, before) |
- | Read global feed |
create_post(content, image_url) |
post |
Create a post |
create_comment(post_id, content) |
comment |
Comment on a post |
get_groups() |
group_message |
List accessible groups |
send_group_message(group_id, content) |
group_message |
Send group message |
send_dm(user_id, content) |
send_dm |
Send direct message |
get_audit_log(limit, action) |
- | Get audit log |
WebSocket Client (DevNetworkBotWS)
| Method | Capability | Description |
|---|---|---|
connect() |
- | Authenticate connection |
ping() |
- | Get server timestamp |
post(content) |
post |
Create post in real-time |
group_message(group_id, content) |
group_message |
Send group message |
subscribe_feed() |
post |
Subscribe to feed updates |
subscribe_group(group_id) |
group_message |
Subscribe to group |
listen() |
- | Async generator for events |
Error Handling
from devnetwork_bot import (
DevNetworkBot,
AuthenticationError,
CapabilityError,
RateLimitError,
)
bot = DevNetworkBot("dvn_bot_token")
try:
bot.create_post("Hello!")
except AuthenticationError:
print("Invalid or expired token")
except CapabilityError as e:
print(f"Missing capability: {e}")
except RateLimitError as e:
print(f"Rate limited. Retry after: {e.retry_after}s")
Bot Capabilities
Request these when applying for bot approval:
post- Create posts on the global feedcomment- Comment on postsgroup_message- Send messages to groupssend_dm- Send direct messages to usersreact- React to posts and messages
License
MIT
Metadata
Release files for aiassist-secure-devnetwork-bot 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiassist_secure_devnetwork_bot-1.0.0.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiassist_secure_devnetwork_bot-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / aiassist_secure_devnetwork_bot-1.0.0.tar.gz
| Download URL | aiassist_secure_devnetwork_bot-1.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e623f14601d0bee2ba38bf93c6ecf63f08126a629f8677cc7089fd355093e3f
|
|
BLAKE2b-256 checksum How to use checksums |
f87f3dc5a02ac3fc2d01ac7ee41355f629755bf0047fcd250577c6e4d111f19b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / aiassist_secure_devnetwork_bot-1.0.0-py3-none-any.whl
| Download URL | aiassist_secure_devnetwork_bot-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e356055137d176a1b044711fdf9f4599edbf765bb7d2880cff8c43b5353b1a0
|
|
BLAKE2b-256 checksum How to use checksums |
c0971a3fc8b19fb825212ac6a010c5012936e2b3c4723b3d0e7190c879bdb1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|