Official Cored OpenAPI SDK for Python
Project description
Cored IM OpenAPI SDK - Python
English | 中文
Cored is a secure, self-hosted productivity platform for teams, integrating instant messaging, organizational structures, video conferencing, and file storage.
This is the official Python SDK for Cored server, used to interact with the Cored server via OpenAPI. You need to deploy the Cored server before using this SDK. See the Quick Deploy Guide for setup instructions.
Installation
pip install cored-sdk
Quick Start
import asyncio
from cored import CoredClient, SendMessageReq, MessageContent, MessageText, MessageType_TEXT
async def main():
client = await CoredClient.create(
"https://your-backend-url.com",
"your-app-id",
"your-app-secret",
)
# Optional: preheat fetches access token and syncs server time upfront,
# reducing latency on the first API call
await client.preheat()
# Call API
resp = await client.im.message.send_message(SendMessageReq(
chat_id="chat-id",
message_type=MessageType_TEXT,
message_content=MessageContent(text=MessageText(content="Cored new version released!")),
))
print(resp.message_id)
# Close when done
await client.close()
asyncio.run(main())
Configuration
CoredClient.create() accepts optional keyword arguments to configure client behavior:
from cored import CoredClient, LogLevel
client = await CoredClient.create(
"https://your-backend-url.com",
"your-app-id",
"your-app-secret",
log_level=LogLevel.DEBUG, # Log level (default: INFO)
request_timeout=30.0, # Request timeout in seconds (default: 60.0)
enable_encryption=False, # Enable request encryption (default: True)
)
Event Subscription
Receive real-time events via WebSocket:
from cored import EventMessageReceive
def on_message(event: EventMessageReceive):
print("Message received:", event.body)
client.im.message.event.on_message_receive(on_message)
# Unsubscribe
client.im.message.event.off_message_receive(on_message)
Context Manager
Supports async with syntax for automatic cleanup:
async with await CoredClient.create(...) as client:
resp = await client.im.message.send_message(SendMessageReq(...))
Requirements
- Python 3.9+
Links
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cored_sdk-0.28.107.tar.gz.
File metadata
- Download URL: cored_sdk-0.28.107.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1dc860b5476fc7e4278e41bc1c2a3dd33f44b7163b79f853d5ad223390d493
|
|
| MD5 |
91b5413c6eb6c0b972526e0ffc9b95f6
|
|
| BLAKE2b-256 |
fb16ec23e3c7fcdc9a0d72d79a665a119c7f194104aec58980f655ea1928f43d
|
Provenance
The following attestation bundles were made for cored_sdk-0.28.107.tar.gz:
Publisher:
publish.yaml on cored-im/openapi-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cored_sdk-0.28.107.tar.gz -
Subject digest:
ef1dc860b5476fc7e4278e41bc1c2a3dd33f44b7163b79f853d5ad223390d493 - Sigstore transparency entry: 1200312110
- Sigstore integration time:
-
Permalink:
cored-im/openapi-sdk-python@47f213dee06974ed59ed26fbf3848dc9fdf1263b -
Branch / Tag:
refs/tags/v0.28.107 - Owner: https://github.com/cored-im
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@47f213dee06974ed59ed26fbf3848dc9fdf1263b -
Trigger Event:
push
-
Statement type:
File details
Details for the file cored_sdk-0.28.107-py3-none-any.whl.
File metadata
- Download URL: cored_sdk-0.28.107-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b7e33f17fab618ac4e93a2c3201ae320d265bc843b1d598647e014b1d09049b
|
|
| MD5 |
c4264b3d0ba98a30bccfa88913264bf0
|
|
| BLAKE2b-256 |
ae8460eb07e96bd81734925f0a32ea567ae05662bf4ad287f6c0713d0262273d
|
Provenance
The following attestation bundles were made for cored_sdk-0.28.107-py3-none-any.whl:
Publisher:
publish.yaml on cored-im/openapi-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cored_sdk-0.28.107-py3-none-any.whl -
Subject digest:
2b7e33f17fab618ac4e93a2c3201ae320d265bc843b1d598647e014b1d09049b - Sigstore transparency entry: 1200312134
- Sigstore integration time:
-
Permalink:
cored-im/openapi-sdk-python@47f213dee06974ed59ed26fbf3848dc9fdf1263b -
Branch / Tag:
refs/tags/v0.28.107 - Owner: https://github.com/cored-im
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@47f213dee06974ed59ed26fbf3848dc9fdf1263b -
Trigger Event:
push
-
Statement type: