oopz-sdk 0.4.3__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.
- oopz/__init__.py +107 -0
- oopz/api.py +1228 -0
- oopz/client.py +370 -0
- oopz/config.py +140 -0
- oopz/exceptions.py +30 -0
- oopz/models.py +333 -0
- oopz/py.typed +0 -0
- oopz/response.py +137 -0
- oopz/sender.py +449 -0
- oopz/signer.py +118 -0
- oopz/upload.py +189 -0
- oopz_sdk-0.4.3.dist-info/METADATA +343 -0
- oopz_sdk-0.4.3.dist-info/RECORD +15 -0
- oopz_sdk-0.4.3.dist-info/WHEEL +5 -0
- oopz_sdk-0.4.3.dist-info/top_level.txt +1 -0
oopz/__init__.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Oopz SDK -- Oopz 平台通信核心库。
|
|
2
|
+
|
|
3
|
+
用法::
|
|
4
|
+
|
|
5
|
+
from oopz import OopzConfig, OopzClient, OopzSender
|
|
6
|
+
|
|
7
|
+
config = OopzConfig(
|
|
8
|
+
device_id="...",
|
|
9
|
+
person_uid="...",
|
|
10
|
+
jwt_token="...",
|
|
11
|
+
private_key="-----BEGIN RSA PRIVATE KEY-----\\n...",
|
|
12
|
+
default_area="...",
|
|
13
|
+
default_channel="...",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
sender = OopzSender(config)
|
|
17
|
+
sender.send_message("Hello!")
|
|
18
|
+
|
|
19
|
+
client = OopzClient(config, on_chat_message=lambda msg: print(msg))
|
|
20
|
+
client.start()
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .config import DEFAULT_HEADERS, OopzConfig
|
|
24
|
+
from .client import (
|
|
25
|
+
EVENT_AUTH,
|
|
26
|
+
EVENT_CHAT_MESSAGE,
|
|
27
|
+
EVENT_HEARTBEAT,
|
|
28
|
+
EVENT_SERVER_ID,
|
|
29
|
+
OopzClient,
|
|
30
|
+
)
|
|
31
|
+
from .models import (
|
|
32
|
+
AreaBlock,
|
|
33
|
+
AreaBlocksResult,
|
|
34
|
+
AreaInfo,
|
|
35
|
+
AreaMembersPage,
|
|
36
|
+
ChannelGroup,
|
|
37
|
+
ChannelGroupsResult,
|
|
38
|
+
ChannelInfo,
|
|
39
|
+
ChatMessageEvent,
|
|
40
|
+
ChannelMessage,
|
|
41
|
+
ChannelSetting,
|
|
42
|
+
DailySpeechResult,
|
|
43
|
+
JoinedAreasResult,
|
|
44
|
+
LifecycleEvent,
|
|
45
|
+
MessageSendResult,
|
|
46
|
+
OperationResult,
|
|
47
|
+
PersonDetail,
|
|
48
|
+
PrivateSessionResult,
|
|
49
|
+
SelfDetail,
|
|
50
|
+
UploadAttachment,
|
|
51
|
+
UploadResult,
|
|
52
|
+
VoiceChannelMember,
|
|
53
|
+
VoiceChannelMembersResult,
|
|
54
|
+
)
|
|
55
|
+
from .exceptions import (
|
|
56
|
+
OopzApiError,
|
|
57
|
+
OopzAuthError,
|
|
58
|
+
OopzConnectionError,
|
|
59
|
+
OopzError,
|
|
60
|
+
OopzRateLimitError,
|
|
61
|
+
)
|
|
62
|
+
from .sender import OopzSender
|
|
63
|
+
from .signer import Signer
|
|
64
|
+
from .upload import UploadMixin, get_image_info
|
|
65
|
+
|
|
66
|
+
__all__ = [
|
|
67
|
+
"AreaInfo",
|
|
68
|
+
"AreaMembersPage",
|
|
69
|
+
"AreaBlock",
|
|
70
|
+
"AreaBlocksResult",
|
|
71
|
+
"ChannelGroup",
|
|
72
|
+
"ChannelGroupsResult",
|
|
73
|
+
"ChannelInfo",
|
|
74
|
+
"ChatMessageEvent",
|
|
75
|
+
"ChannelMessage",
|
|
76
|
+
"ChannelSetting",
|
|
77
|
+
"DEFAULT_HEADERS",
|
|
78
|
+
"DailySpeechResult",
|
|
79
|
+
"EVENT_AUTH",
|
|
80
|
+
"EVENT_CHAT_MESSAGE",
|
|
81
|
+
"EVENT_HEARTBEAT",
|
|
82
|
+
"EVENT_SERVER_ID",
|
|
83
|
+
"JoinedAreasResult",
|
|
84
|
+
"LifecycleEvent",
|
|
85
|
+
"MessageSendResult",
|
|
86
|
+
"OopzApiError",
|
|
87
|
+
"OopzAuthError",
|
|
88
|
+
"OopzClient",
|
|
89
|
+
"OopzConfig",
|
|
90
|
+
"OopzConnectionError",
|
|
91
|
+
"OopzError",
|
|
92
|
+
"OopzRateLimitError",
|
|
93
|
+
"OopzSender",
|
|
94
|
+
"OperationResult",
|
|
95
|
+
"PersonDetail",
|
|
96
|
+
"PrivateSessionResult",
|
|
97
|
+
"SelfDetail",
|
|
98
|
+
"Signer",
|
|
99
|
+
"UploadAttachment",
|
|
100
|
+
"UploadResult",
|
|
101
|
+
"UploadMixin",
|
|
102
|
+
"VoiceChannelMember",
|
|
103
|
+
"VoiceChannelMembersResult",
|
|
104
|
+
"get_image_info",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
__version__ = "0.4.3"
|