imbot-sdk-python 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
imbot_sdk/__init__.py CHANGED
@@ -35,7 +35,7 @@ from .models import (
35
35
  UserInfo,
36
36
  )
37
37
 
38
- __version__ = "0.1.1"
38
+ __version__ = "0.1.2"
39
39
 
40
40
  __all__ = [
41
41
  "ImBotClient",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: imbot-sdk-python
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: JuggleIM Python Bot SDK — WebSocket long-connection IM client for bots and server-side agents
5
5
  Author-email: Tyler <tyler@juggle.im>
6
6
  Maintainer-email: Tyler <tyler@juggle.im>
@@ -78,6 +78,37 @@ pip install .
78
78
  > + AppSecret via the Server API. The SDK itself only establishes the
79
79
  > connection and sends/receives messages.
80
80
 
81
+ ## Obtaining a token
82
+
83
+ `connect(token)` needs a per-user token. Tokens are minted by your app server
84
+ through the JuggleIM Server API using your AppKey + AppSecret. Registering a bot
85
+ (or a user) returns a token:
86
+
87
+ - Endpoint: `POST {ServerAPI}/bots/register` (or `/users/register`)
88
+ - Auth headers: `appkey`, `nonce` (random 0-9999), `timestamp` (epoch ms),
89
+ `signature = lowercase_hex( SHA1(AppSecret + nonce + timestamp) )`,
90
+ `Content-Type: application/json`
91
+ - Response: `{"code":0,"msg":"success","data":{"user_id":"...","token":"..."}}`
92
+
93
+ A ready-to-use helper (standard library only, no hard-coded credentials) is
94
+ [`examples/register_bot.py`](examples/register_bot.py):
95
+
96
+ ```bash
97
+ export IMBOT_API_URL="https://api.juggleim.com/apigateway"
98
+ export IMBOT_APPKEY="<your-appkey>"
99
+ export IMBOT_APPSECRET="<your-appsecret>"
100
+
101
+ # register a bot and print its token
102
+ python examples/register_bot.py --bot-id my-bot --nickname "My Bot"
103
+
104
+ # or register a normal user
105
+ python examples/register_bot.py --user --user-id u1 --nickname "User 1"
106
+ ```
107
+
108
+ > Keep your AppSecret on the server side — never ship it inside client apps.
109
+ > If the Server API host presents an expired/invalid TLS certificate, pass
110
+ > `--insecure` to bypass verification (use only against endpoints you trust).
111
+
81
112
  ## Feature overview
82
113
 
83
114
  - Connection management: `connect`, `disconnect`, `logout`, heartbeat keep-alive,
@@ -1,4 +1,4 @@
1
- imbot_sdk/__init__.py,sha256=k6zcvfWBE9b8tXSPlC9B9hGRV0_It6erzEgeqFxQR60,1456
1
+ imbot_sdk/__init__.py,sha256=NFKl861qKklXQpKq1aiLm4sq_pN8P0IzshwUKErxC7k,1456
2
2
  imbot_sdk/client.py,sha256=qOG3BZOBZH_JA_0iDpxrFVQGgfwdyRJ2NZzWNop2Y2M,46357
3
3
  imbot_sdk/consts.py,sha256=EQhnWoc0RFDMIpZl7posvVwFDblnpQ0VJaW-bgAC6IQ,754
4
4
  imbot_sdk/data_accessor.py,sha256=om_UzAAgCGtNqWZbLcpU0VFq_Tmi-Xi3lkwv-E-unHw,1018
@@ -13,8 +13,8 @@ imbot_sdk/pb/appmessages_pb2.py,sha256=7yyt_KqDs7rO8TtYO88AJIqfB5yLfoPV3PwRSpidu
13
13
  imbot_sdk/pb/chatroom_pb2.py,sha256=2SD6pyFKZuFhOvvZbDffX591OrYqv8q7eNm4SA-7s9o,9452
14
14
  imbot_sdk/pb/connect_pb2.py,sha256=k3QU7PAaYL_umjV5WXloxgWlYvKrM7CSV6Fj0eBxhzo,4777
15
15
  imbot_sdk/pb/rtcroom_pb2.py,sha256=v9uuWxbEvsmwHHt9OLuDvE4w1v0wQX7e1Xxv0mKFQPo,8037
16
- imbot_sdk_python-0.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- imbot_sdk_python-0.1.1.dist-info/METADATA,sha256=Ien770JAC4tE9ZTFWzo6I9LrSiw4UmbNGHkL0-jUmxo,11529
18
- imbot_sdk_python-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
19
- imbot_sdk_python-0.1.1.dist-info/top_level.txt,sha256=Q636V3MNhiMZGfV2FfiBcNaYh4bHlVB0iXVMQgVuoeo,10
20
- imbot_sdk_python-0.1.1.dist-info/RECORD,,
16
+ imbot_sdk_python-0.1.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ imbot_sdk_python-0.1.2.dist-info/METADATA,sha256=IeEszLrZnszijy28ns-IH2783qO5f5DFFRb-T1uXLmE,12792
18
+ imbot_sdk_python-0.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
19
+ imbot_sdk_python-0.1.2.dist-info/top_level.txt,sha256=Q636V3MNhiMZGfV2FfiBcNaYh4bHlVB0iXVMQgVuoeo,10
20
+ imbot_sdk_python-0.1.2.dist-info/RECORD,,