cime.py 1.0.0__tar.gz
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.
- cime_py-1.0.0/LICENSE +21 -0
- cime_py-1.0.0/PKG-INFO +82 -0
- cime_py-1.0.0/README.md +64 -0
- cime_py-1.0.0/cime/__init__.py +3 -0
- cime_py-1.0.0/cime/client.py +118 -0
- cime_py-1.0.0/cime/events.py +52 -0
- cime_py-1.0.0/cime/models.py +80 -0
- cime_py-1.0.0/cime.py.egg-info/PKG-INFO +82 -0
- cime_py-1.0.0/cime.py.egg-info/SOURCES.txt +12 -0
- cime_py-1.0.0/cime.py.egg-info/dependency_links.txt +1 -0
- cime_py-1.0.0/cime.py.egg-info/requires.txt +3 -0
- cime_py-1.0.0/cime.py.egg-info/top_level.txt +1 -0
- cime_py-1.0.0/pyproject.toml +27 -0
- cime_py-1.0.0/setup.cfg +4 -0
cime_py-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 chocolily (medeia_beliar@naver.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cime_py-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cime.py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Unofficial Python SDK for CI.ME OpenAPI
|
|
5
|
+
Author-email: chocolily <medeia_beliar@naver.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/choco-lily/cime.py
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/choco-lily/cime.py/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: httpx
|
|
15
|
+
Requires-Dist: websockets
|
|
16
|
+
Requires-Dist: pydantic
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# cime.py
|
|
20
|
+
|
|
21
|
+
CI.ME 공식 API를 활용한 비공식 Python SDK입니다.
|
|
22
|
+
(Unofficial Python SDK using Official CI.ME OpenAPI)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install cime.py
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Async Client Initialization
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import asyncio
|
|
36
|
+
from cime import CimeClient
|
|
37
|
+
|
|
38
|
+
async def main():
|
|
39
|
+
async with CimeClient(
|
|
40
|
+
client_id='YOUR_CLIENT_ID',
|
|
41
|
+
client_secret='YOUR_CLIENT_SECRET'
|
|
42
|
+
) as client:
|
|
43
|
+
# Use bearer token for user-specific actions
|
|
44
|
+
# client.bearer_token = 'YOUR_BEARER_TOKEN'
|
|
45
|
+
|
|
46
|
+
me = await client.get_me()
|
|
47
|
+
print(f"My Channel: {me.content.channelName}")
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### WebSocket Events
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
from cime import CimeEvents, CimeClient
|
|
57
|
+
|
|
58
|
+
async def on_chat(data):
|
|
59
|
+
print(f"New Chat: {data['message']}")
|
|
60
|
+
|
|
61
|
+
async def main():
|
|
62
|
+
async with CimeClient(client_id='...', client_secret='...') as client:
|
|
63
|
+
session = await client.create_session()
|
|
64
|
+
events = CimeEvents(session.content.url)
|
|
65
|
+
|
|
66
|
+
events.on("CHAT", on_chat)
|
|
67
|
+
await events.subscribe("CHAT")
|
|
68
|
+
|
|
69
|
+
await events.connect()
|
|
70
|
+
|
|
71
|
+
asyncio.run(main())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- CI.ME REST API (User, Channel, Live, Chat, etc.) 완벽 지원
|
|
77
|
+
- `httpx` 및 `websockets` 기반의 고성능 비동기 설계
|
|
78
|
+
- Pydantic 모델을 통한 강력한 데이터 검증 및 타입 힌트 제공
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
cime_py-1.0.0/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# cime.py
|
|
2
|
+
|
|
3
|
+
CI.ME 공식 API를 활용한 비공식 Python SDK입니다.
|
|
4
|
+
(Unofficial Python SDK using Official CI.ME OpenAPI)
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install cime.py
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
### Async Client Initialization
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import asyncio
|
|
18
|
+
from cime import CimeClient
|
|
19
|
+
|
|
20
|
+
async def main():
|
|
21
|
+
async with CimeClient(
|
|
22
|
+
client_id='YOUR_CLIENT_ID',
|
|
23
|
+
client_secret='YOUR_CLIENT_SECRET'
|
|
24
|
+
) as client:
|
|
25
|
+
# Use bearer token for user-specific actions
|
|
26
|
+
# client.bearer_token = 'YOUR_BEARER_TOKEN'
|
|
27
|
+
|
|
28
|
+
me = await client.get_me()
|
|
29
|
+
print(f"My Channel: {me.content.channelName}")
|
|
30
|
+
|
|
31
|
+
asyncio.run(main())
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### WebSocket Events
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import asyncio
|
|
38
|
+
from cime import CimeEvents, CimeClient
|
|
39
|
+
|
|
40
|
+
async def on_chat(data):
|
|
41
|
+
print(f"New Chat: {data['message']}")
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
async with CimeClient(client_id='...', client_secret='...') as client:
|
|
45
|
+
session = await client.create_session()
|
|
46
|
+
events = CimeEvents(session.content.url)
|
|
47
|
+
|
|
48
|
+
events.on("CHAT", on_chat)
|
|
49
|
+
await events.subscribe("CHAT")
|
|
50
|
+
|
|
51
|
+
await events.connect()
|
|
52
|
+
|
|
53
|
+
asyncio.run(main())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- CI.ME REST API (User, Channel, Live, Chat, etc.) 완벽 지원
|
|
59
|
+
- `httpx` 및 `websockets` 기반의 고성능 비동기 설계
|
|
60
|
+
- Pydantic 모델을 통한 강력한 데이터 검증 및 타입 힌트 제공
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
from typing import Optional, List, Dict, Any, Union
|
|
3
|
+
from .models import (
|
|
4
|
+
AuthConfig,
|
|
5
|
+
CimeResponse,
|
|
6
|
+
UserChannelInfo,
|
|
7
|
+
BulkChannelResponse,
|
|
8
|
+
LiveListResponse,
|
|
9
|
+
LiveSetting,
|
|
10
|
+
ChatSettings,
|
|
11
|
+
MessageResponse,
|
|
12
|
+
CategorySearchResponse,
|
|
13
|
+
SessionResponse
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
class CimeClient:
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
client_id: Optional[str] = None,
|
|
20
|
+
client_secret: Optional[str] = None,
|
|
21
|
+
bearer_token: Optional[str] = None,
|
|
22
|
+
base_url: str = 'https://openapi.ci.me'
|
|
23
|
+
):
|
|
24
|
+
self.client_id = client_id
|
|
25
|
+
self.client_secret = client_secret
|
|
26
|
+
self.bearer_token = bearer_token
|
|
27
|
+
self.base_url = base_url
|
|
28
|
+
self.client = httpx.AsyncClient(base_url=base_url)
|
|
29
|
+
|
|
30
|
+
async def __aenter__(self):
|
|
31
|
+
return self
|
|
32
|
+
|
|
33
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
34
|
+
await self.client.aclose()
|
|
35
|
+
|
|
36
|
+
def _get_headers(self) -> Dict[str, str]:
|
|
37
|
+
headers = {}
|
|
38
|
+
if self.bearer_token:
|
|
39
|
+
headers['Authorization'] = f'Bearer {self.bearer_token}'
|
|
40
|
+
elif self.client_id and self.client_secret:
|
|
41
|
+
headers['Client-Id'] = self.client_id
|
|
42
|
+
headers['Client-Secret'] = self.client_secret
|
|
43
|
+
return headers
|
|
44
|
+
|
|
45
|
+
async def get_me(self) -> CimeResponse[UserChannelInfo]:
|
|
46
|
+
resp = await self.client.get('/api/openapi/open/v1/users/me', headers=self._get_headers())
|
|
47
|
+
return CimeResponse[UserChannelInfo](**resp.json())
|
|
48
|
+
|
|
49
|
+
async def get_channels(self, channel_ids: List[str]) -> CimeResponse[BulkChannelResponse]:
|
|
50
|
+
params = {'channelIds': ','.join(channel_ids)}
|
|
51
|
+
resp = await self.client.get('/api/openapi/open/v1/channels', params=params, headers=self._get_headers())
|
|
52
|
+
return CimeResponse[BulkChannelResponse](**resp.json())
|
|
53
|
+
|
|
54
|
+
async def get_followers(self) -> CimeResponse[Any]:
|
|
55
|
+
resp = await self.client.get('/api/openapi/open/v1/channels/followers', headers=self._get_headers())
|
|
56
|
+
return CimeResponse[Any](**resp.json())
|
|
57
|
+
|
|
58
|
+
async def get_subscribers(self) -> CimeResponse[Any]:
|
|
59
|
+
resp = await self.client.get('/api/openapi/open/v1/channels/subscribers', headers=self._get_headers())
|
|
60
|
+
return CimeResponse[Any](**resp.json())
|
|
61
|
+
|
|
62
|
+
async def get_lives(
|
|
63
|
+
self,
|
|
64
|
+
channel_ids: Optional[List[str]] = None,
|
|
65
|
+
page: Optional[int] = None,
|
|
66
|
+
size: Optional[int] = None
|
|
67
|
+
) -> CimeResponse[LiveListResponse]:
|
|
68
|
+
params = {}
|
|
69
|
+
if channel_ids: params['channelIds'] = ','.join(channel_ids)
|
|
70
|
+
if page is not None: params['page'] = page
|
|
71
|
+
if size is not None: params['size'] = size
|
|
72
|
+
|
|
73
|
+
resp = await self.client.get('/api/openapi/open/v1/lives', params=params, headers=self._get_headers())
|
|
74
|
+
return CimeResponse[LiveListResponse](**resp.json())
|
|
75
|
+
|
|
76
|
+
async def get_live_setting(self) -> CimeResponse[LiveSetting]:
|
|
77
|
+
resp = await self.client.get('/api/openapi/open/v1/lives/setting', headers=self._get_headers())
|
|
78
|
+
return CimeResponse[LiveSetting](**resp.json())
|
|
79
|
+
|
|
80
|
+
async def update_live_setting(self, settings: Dict[str, Any]) -> CimeResponse[LiveSetting]:
|
|
81
|
+
resp = await self.client.patch('/api/openapi/open/v1/lives/setting', json=settings, headers=self._get_headers())
|
|
82
|
+
return CimeResponse[LiveSetting](**resp.json())
|
|
83
|
+
|
|
84
|
+
async def get_chat_settings(self) -> CimeResponse[ChatSettings]:
|
|
85
|
+
resp = await self.client.get('/api/openapi/open/v1/chats/settings', headers=self._get_headers())
|
|
86
|
+
return CimeResponse[ChatSettings](**resp.json())
|
|
87
|
+
|
|
88
|
+
async def update_chat_settings(self, settings: Dict[str, Any]) -> CimeResponse[ChatSettings]:
|
|
89
|
+
resp = await self.client.put('/api/openapi/open/v1/chats/settings', json=settings, headers=self._get_headers())
|
|
90
|
+
return CimeResponse[ChatSettings](**resp.json())
|
|
91
|
+
|
|
92
|
+
async def send_chat(self, message: str) -> CimeResponse[MessageResponse]:
|
|
93
|
+
resp = await self.client.post('/api/openapi/open/v1/chats/send', json={'message': message}, headers=self._get_headers())
|
|
94
|
+
return CimeResponse[MessageResponse](**resp.json())
|
|
95
|
+
|
|
96
|
+
async def search_categories(self, keyword: str, size: Optional[int] = None) -> CimeResponse[CategorySearchResponse]:
|
|
97
|
+
params = {'keyword': keyword}
|
|
98
|
+
if size is not None: params['size'] = size
|
|
99
|
+
resp = await self.client.get('/api/openapi/open/v1/categories/search', params=params, headers=self._get_headers())
|
|
100
|
+
return CimeResponse[CategorySearchResponse](**resp.json())
|
|
101
|
+
|
|
102
|
+
async def get_restrict_channels(self) -> CimeResponse[Any]:
|
|
103
|
+
resp = await self.client.get('/api/openapi/open/v1/restrict-channels', headers=self._get_headers())
|
|
104
|
+
return CimeResponse[Any](**resp.json())
|
|
105
|
+
|
|
106
|
+
async def restrict_channel(self, channel_id: str) -> CimeResponse[Any]:
|
|
107
|
+
resp = await self.client.post('/api/openapi/open/v1/restrict-channels', json={'channelId': channel_id}, headers=self._get_headers())
|
|
108
|
+
return CimeResponse[Any](**resp.json())
|
|
109
|
+
|
|
110
|
+
async def unrestrict_channel(self, channel_id: str) -> CimeResponse[Any]:
|
|
111
|
+
# httpx for DELETE with body needs 'content' or 'json'
|
|
112
|
+
resp = await self.client.request("DELETE", '/api/openapi/open/v1/restrict-channels', json={'channelId': channel_id}, headers=self._get_headers())
|
|
113
|
+
return CimeResponse[Any](**resp.json())
|
|
114
|
+
|
|
115
|
+
async def create_session(self, use_client_auth: bool = False) -> CimeResponse[SessionResponse]:
|
|
116
|
+
endpoint = '/api/openapi/open/v1/sessions/auth/client' if use_client_auth else '/api/openapi/open/v1/sessions/auth'
|
|
117
|
+
resp = await self.client.post(endpoint, headers=self._get_headers())
|
|
118
|
+
return CimeResponse[SessionResponse](**resp.json())
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
import websockets
|
|
4
|
+
from typing import Callable, Coroutine, Any, Dict, Set
|
|
5
|
+
|
|
6
|
+
class CimeEvents:
|
|
7
|
+
def __init__(self, url: str):
|
|
8
|
+
self.url = url
|
|
9
|
+
self.ws = None
|
|
10
|
+
self.handlers: Dict[str, Set[Callable[[Any], Coroutine]]] = {}
|
|
11
|
+
self.subscriptions: Set[str] = set()
|
|
12
|
+
self._running = False
|
|
13
|
+
|
|
14
|
+
def on(self, event_type: str, handler: Callable[[Any], Coroutine]):
|
|
15
|
+
if event_type not in self.handlers:
|
|
16
|
+
self.handlers[event_type] = set()
|
|
17
|
+
self.handlers[event_type].add(handler)
|
|
18
|
+
|
|
19
|
+
async def connect(self):
|
|
20
|
+
async with websockets.connect(self.url) as self.ws:
|
|
21
|
+
self._running = True
|
|
22
|
+
await self._resubscribe()
|
|
23
|
+
while self._running:
|
|
24
|
+
try:
|
|
25
|
+
message_raw = await self.ws.recv()
|
|
26
|
+
message = json.loads(message_raw)
|
|
27
|
+
event_type = message.get("type")
|
|
28
|
+
data = message.get("data")
|
|
29
|
+
|
|
30
|
+
if event_type in self.handlers:
|
|
31
|
+
for handler in self.handlers[event_type]:
|
|
32
|
+
asyncio.create_task(handler(data))
|
|
33
|
+
except websockets.exceptions.ConnectionClosed:
|
|
34
|
+
break
|
|
35
|
+
self._running = False
|
|
36
|
+
|
|
37
|
+
async def _resubscribe(self):
|
|
38
|
+
for topic in self.subscriptions:
|
|
39
|
+
await self.ws.send(json.dumps({"type": "SUBSCRIBE", "topic": topic}))
|
|
40
|
+
|
|
41
|
+
async def subscribe(self, topic: str):
|
|
42
|
+
self.subscriptions.add(topic)
|
|
43
|
+
if self.ws and not self.ws.closed:
|
|
44
|
+
await self.ws.send(json.dumps({"type": "SUBSCRIBE", "topic": topic}))
|
|
45
|
+
|
|
46
|
+
async def unsubscribe(self, topic: str):
|
|
47
|
+
self.subscriptions.remove(topic)
|
|
48
|
+
if self.ws and not self.ws.closed:
|
|
49
|
+
await self.ws.send(json.dumps({"type": "UNSUBSCRIBE", "topic": topic}))
|
|
50
|
+
|
|
51
|
+
def disconnect(self):
|
|
52
|
+
self._running = False
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from typing import List, Optional, Generic, TypeVar, Literal
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
T = TypeVar('T')
|
|
6
|
+
|
|
7
|
+
class CimeResponse(BaseModel, Generic[T]):
|
|
8
|
+
code: int
|
|
9
|
+
message: Optional[str] = None
|
|
10
|
+
content: T
|
|
11
|
+
|
|
12
|
+
class UserChannelInfo(BaseModel):
|
|
13
|
+
channelId: str
|
|
14
|
+
channelName: str
|
|
15
|
+
channelHandle: str
|
|
16
|
+
|
|
17
|
+
class Channel(BaseModel):
|
|
18
|
+
channelId: str
|
|
19
|
+
channelName: str
|
|
20
|
+
channelHandle: str
|
|
21
|
+
channelImageUrl: Optional[str] = None
|
|
22
|
+
channelDescription: str
|
|
23
|
+
followerCount: int
|
|
24
|
+
|
|
25
|
+
class BulkChannelResponse(BaseModel):
|
|
26
|
+
data: List[Channel]
|
|
27
|
+
|
|
28
|
+
class Live(BaseModel):
|
|
29
|
+
liveId: str
|
|
30
|
+
liveTitle: str
|
|
31
|
+
liveThumbnailImageUrl: Optional[str] = None
|
|
32
|
+
concurrentUserCount: int
|
|
33
|
+
openedDate: Optional[str] = None
|
|
34
|
+
adult: bool
|
|
35
|
+
tags: List[str]
|
|
36
|
+
categoryType: Optional[str] = None
|
|
37
|
+
liveCategory: Optional[str] = None
|
|
38
|
+
liveCategoryValue: Optional[str] = None
|
|
39
|
+
channelId: str
|
|
40
|
+
channelName: str
|
|
41
|
+
channelHandle: str
|
|
42
|
+
channelImageUrl: Optional[str] = None
|
|
43
|
+
|
|
44
|
+
class Page(BaseModel):
|
|
45
|
+
next: Optional[int] = None
|
|
46
|
+
|
|
47
|
+
class LiveListResponse(BaseModel):
|
|
48
|
+
data: List[Live]
|
|
49
|
+
page: Page
|
|
50
|
+
|
|
51
|
+
class LiveSetting(BaseModel):
|
|
52
|
+
defaultLiveTitle: str
|
|
53
|
+
categoryType: Optional[str] = None
|
|
54
|
+
liveCategory: Optional[str] = None
|
|
55
|
+
tags: List[str]
|
|
56
|
+
|
|
57
|
+
class ChatSettings(BaseModel):
|
|
58
|
+
chatAllowedGroup: Literal['ALL', 'FOLLOWER', 'MANAGER']
|
|
59
|
+
minFollowerMinute: int
|
|
60
|
+
followerSubscriberChatAllow: Optional[bool] = None
|
|
61
|
+
|
|
62
|
+
class MessageResponse(BaseModel):
|
|
63
|
+
messageId: str
|
|
64
|
+
|
|
65
|
+
class Category(BaseModel):
|
|
66
|
+
categoryId: str
|
|
67
|
+
categoryType: str
|
|
68
|
+
categoryValue: str
|
|
69
|
+
posterImageUrl: Optional[str] = None
|
|
70
|
+
|
|
71
|
+
class CategorySearchResponse(BaseModel):
|
|
72
|
+
data: List[Category]
|
|
73
|
+
|
|
74
|
+
class SessionResponse(BaseModel):
|
|
75
|
+
url: str
|
|
76
|
+
|
|
77
|
+
class EventType(str, Enum):
|
|
78
|
+
CHAT = 'CHAT'
|
|
79
|
+
DONATION = 'DONATION'
|
|
80
|
+
SUBSCRIPTION = 'SUBSCRIPTION'
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cime.py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Unofficial Python SDK for CI.ME OpenAPI
|
|
5
|
+
Author-email: chocolily <medeia_beliar@naver.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/choco-lily/cime.py
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/choco-lily/cime.py/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: httpx
|
|
15
|
+
Requires-Dist: websockets
|
|
16
|
+
Requires-Dist: pydantic
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# cime.py
|
|
20
|
+
|
|
21
|
+
CI.ME 공식 API를 활용한 비공식 Python SDK입니다.
|
|
22
|
+
(Unofficial Python SDK using Official CI.ME OpenAPI)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install cime.py
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Async Client Initialization
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import asyncio
|
|
36
|
+
from cime import CimeClient
|
|
37
|
+
|
|
38
|
+
async def main():
|
|
39
|
+
async with CimeClient(
|
|
40
|
+
client_id='YOUR_CLIENT_ID',
|
|
41
|
+
client_secret='YOUR_CLIENT_SECRET'
|
|
42
|
+
) as client:
|
|
43
|
+
# Use bearer token for user-specific actions
|
|
44
|
+
# client.bearer_token = 'YOUR_BEARER_TOKEN'
|
|
45
|
+
|
|
46
|
+
me = await client.get_me()
|
|
47
|
+
print(f"My Channel: {me.content.channelName}")
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### WebSocket Events
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
from cime import CimeEvents, CimeClient
|
|
57
|
+
|
|
58
|
+
async def on_chat(data):
|
|
59
|
+
print(f"New Chat: {data['message']}")
|
|
60
|
+
|
|
61
|
+
async def main():
|
|
62
|
+
async with CimeClient(client_id='...', client_secret='...') as client:
|
|
63
|
+
session = await client.create_session()
|
|
64
|
+
events = CimeEvents(session.content.url)
|
|
65
|
+
|
|
66
|
+
events.on("CHAT", on_chat)
|
|
67
|
+
await events.subscribe("CHAT")
|
|
68
|
+
|
|
69
|
+
await events.connect()
|
|
70
|
+
|
|
71
|
+
asyncio.run(main())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- CI.ME REST API (User, Channel, Live, Chat, etc.) 완벽 지원
|
|
77
|
+
- `httpx` 및 `websockets` 기반의 고성능 비동기 설계
|
|
78
|
+
- Pydantic 모델을 통한 강력한 데이터 검증 및 타입 힌트 제공
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
cime/__init__.py
|
|
5
|
+
cime/client.py
|
|
6
|
+
cime/events.py
|
|
7
|
+
cime/models.py
|
|
8
|
+
cime.py.egg-info/PKG-INFO
|
|
9
|
+
cime.py.egg-info/SOURCES.txt
|
|
10
|
+
cime.py.egg-info/dependency_links.txt
|
|
11
|
+
cime.py.egg-info/requires.txt
|
|
12
|
+
cime.py.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cime
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cime.py"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="chocolily", email="medeia_beliar@naver.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "Unofficial Python SDK for CI.ME OpenAPI"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"httpx",
|
|
21
|
+
"websockets",
|
|
22
|
+
"pydantic",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
"Homepage" = "https://github.com/choco-lily/cime.py"
|
|
27
|
+
"Bug Tracker" = "https://github.com/choco-lily/cime.py/issues"
|
cime_py-1.0.0/setup.cfg
ADDED