Skip to content

juggleim/imserver-sdk-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

JuggleIM Server Python SDK

A dependency-free Python client for the JuggleIM Server REST API.

CI Python License Stars

English · 简体中文

Website · Documentation · Server API · IM Server


imserver-sdk-python lets a trusted Python backend call JuggleIM server APIs without reimplementing request signing, serialization, and response mapping. It uses only the Python standard library and is intended for server-side applications.

Important

Your app secret grants privileged server API access. Never embed it in a mobile, desktop, browser, or other client application.

API coverage

  • Users: registration, profiles, online status, bans, blocks, devices, and settings
  • Messages: private, group, chatroom, broadcast, recall, and history
  • Groups, conversations, chatrooms, friends, moments, and public channels
  • Push tags, sensitive words, bots, device binding, and global mute controls

For other server languages, see the Go and Java SDKs.

Requirements

  • Python 3.10 or newer
  • A running JuggleIM server
  • An app key and app secret created in the JuggleIM admin console

Install from source

The package is not currently published on PyPI. Install the tagged source directly:

python -m pip install "git+https://github.com/juggleim/imserver-sdk-python.git@v1.0.0"

For local development:

git clone https://github.com/juggleim/imserver-sdk-python.git
cd imserver-sdk-python
python -m pip install -e .

Quick start

Set server credentials outside your source code:

export JUGGLEIM_APP_KEY="your-app-key"
export JUGGLEIM_APP_SECRET="your-app-secret"
export JUGGLEIM_API_URL="http://127.0.0.1:9001"

Register a user:

import os

from juggleimsdk import User, new_juggle_im_sdk

sdk = new_juggle_im_sdk(
    os.environ["JUGGLEIM_APP_KEY"],
    os.environ["JUGGLEIM_APP_SECRET"],
    os.environ.get("JUGGLEIM_API_URL", "http://127.0.0.1:9001"),
)

user, code, trace_id, error = sdk.register(
    User(user_id="alice", nickname="Alice")
)

if error:
    raise RuntimeError(f"register failed: code={code}, trace_id={trace_id}: {error}")

print(user.user_id, user.token)

SDK methods return (data, code, trace_id, error) when the endpoint returns data, or (code, trace_id, error) for operations without a response body. Always log the trace ID when reporting a failed request.

See examples/main.py and the Server API reference for more operations.

Development

The test suite does not call a live JuggleIM server:

python -m unittest discover -s tests -v
python -m build

Community and support

License

Apache License 2.0

About

Server-side Python SDK for JuggleIM — users, messages, groups, chatrooms, conversations, history, moderation, and bots.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages