magiccampus-im-sdk
Python SDK and CLI for MagicCampus login, messaging, and websocket sync.
This project bundles the OpenIM transport implementation inside magiccampus_sdk, but removes direct user-facing dependency on OpenIM token and endpoint configuration. You only configure:
apiurlapikeyplatform
At runtime, the SDK calls:
GET /api/v1/accounts/imToken?platform=<PLATFORM>
and uses the response fields:
userIdimTokenwsApihttpApi
Install locally
uv sync
This repository vendors only the OpenIM transport pieces that magiccampus_sdk actually uses.
CLI quick start
magic-campus --help
magic-campus config init --apiurl https://api-test.pearlapi.com --apikey "$MAGICCAMPUS_APIKEY" --platform IOS --default true
magic-campus auth status --format pretty
magic-campus notify +send --to user:10134002 --text "hello"
magic-campus config init also supports an interactive TTY flow when you omit auth flags.
notify +send sends over MagicCampus HTTP POST /agent/v1/im/sendMessage. notify +history still relies on the websocket transport and local sync database.
CLI config is stored at:
~/.mushroom_agent/auth/magiccampus-im-sdk.json
Supported commands:
config init|list|use|removeauth statusnotify +sendnotify +history
Python websocket quick start
from magiccampus_sdk import MagicCampusWSSDK, MagicCampusWSConfig
sdk = MagicCampusWSSDK(
MagicCampusWSConfig(
apiurl="https://api-test.pearlapi.com",
apikey="YOUR_API_KEY",
platform="IOS",
data_dir="./magiccampus_data",
)
)
sdk.login()
sdk.start()
sdk.send_text("hello", recv_id="10134002")
Runnable examples live in magiccampus_sdk/example.py and magiccampus_sdk/example_ws.py.
CLI smoke script
An executable smoke helper lives at scripts/smoke_cli.py.
Offline-safe mode only exercises config persistence and notify dry-run:
uv run python scripts/smoke_cli.py
This mode does not require a real API key. It uses a placeholder key by default and avoids any live auth call.
Real network mode
To run the live auth probe, provide a real API key and enable --live:
export MAGICCAMPUS_APIURL=https://api-test.pearlapi.com
export MAGICCAMPUS_APIKEY='your real api key'
export MAGICCAMPUS_PLATFORM=IOS
uv run python scripts/smoke_cli.py --live
Optional variables:
MAGICCAMPUS_SMOKE_TARGET: target used by dry-run and optional live send, defaultuser:smoke-targetMAGICCAMPUS_PLATFORM: defaults toIOS
If you also want to send a real text message, set a real target and pass --live-send:
export MAGICCAMPUS_SMOKE_TARGET='user:10134002'
uv run python scripts/smoke_cli.py --live --live-send --text 'hello from smoke script'
--live-send performs a real outbound send, so use it only with a valid target and credentials.
Notes
apiurlcan point to any MagicCampus API base URL; the CLI and SDK append/api/v1/accounts/imTokenplatformdefaults toIOS- low-level message send / receive behavior comes from the bundled transport modules inside
magiccampus_sdk - the wrapper does not persist raw OpenIM credentials in CLI config
Metadata
Release files for magiccampus-im-sdk 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| magiccampus_im_sdk-0.1.3.tar.gz | 61.3 kB | Without provenance | Details for magiccampus_im_sdk-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| magiccampus_im_sdk-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for magiccampus_im_sdk-0.1.3-py3-none-any.whl |
Total release size: 128.1 kB
Release files / magiccampus_im_sdk-0.1.3.tar.gz
| Download URL | magiccampus_im_sdk-0.1.3.tar.gz |
|---|---|
| Size | 61.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fa81392234abcf5626859aafa2cd7db62dc3bbf9dd750cdbd4818174f6ee2dc
|
|
BLAKE2b-256 checksum How to use checksums |
04d43c9ad8f7501fc94dcb66c568c311b4b578e1d3abc5f679955abf3d14b258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / magiccampus_im_sdk-0.1.3-py3-none-any.whl
| Download URL | magiccampus_im_sdk-0.1.3-py3-none-any.whl |
|---|---|
| Size | 66.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a778e2f1eb8bed1958cfcd61b13db2371c75fa5eeb6e79c0044fad145e5ca503
|
|
BLAKE2b-256 checksum How to use checksums |
8b51ca3dccc0efda5895ebfcf57a12878321e81acb8e7bdea25fabec63b2e13f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for magiccampus-im-sdk 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.