mocoldtt 0.1.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.
- mocoldtt-0.1.0/PKG-INFO +18 -0
- mocoldtt-0.1.0/README.md +8 -0
- mocoldtt-0.1.0/mocoldtt/__init__.py +7 -0
- mocoldtt-0.1.0/mocoldtt/client.py +167 -0
- mocoldtt-0.1.0/mocoldtt/exceptions.py +2 -0
- mocoldtt-0.1.0/mocoldtt.egg-info/PKG-INFO +18 -0
- mocoldtt-0.1.0/mocoldtt.egg-info/SOURCES.txt +10 -0
- mocoldtt-0.1.0/mocoldtt.egg-info/dependency_links.txt +1 -0
- mocoldtt-0.1.0/mocoldtt.egg-info/requires.txt +1 -0
- mocoldtt-0.1.0/mocoldtt.egg-info/top_level.txt +1 -0
- mocoldtt-0.1.0/pyproject.toml +19 -0
- mocoldtt-0.1.0/setup.cfg +4 -0
mocoldtt-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mocoldtt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Mocol Daiko API SDK for Discord bots
|
|
5
|
+
Author: Mocol
|
|
6
|
+
Project-URL: Homepage, https://m0col.com
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: requests>=2.31.0
|
|
10
|
+
|
|
11
|
+
# mocol-daiko-sdk
|
|
12
|
+
|
|
13
|
+
Mocol Daiko API SDK.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install mocol-daiko-sdk
|
mocoldtt-0.1.0/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
from .exceptions import MocolDaikoError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class MocolDaikoClient:
|
|
7
|
+
def __init__(self, api_url: str, api_key: str, timeout: int = 180):
|
|
8
|
+
self.api_url = api_url.rstrip("/")
|
|
9
|
+
self.api_key = api_key
|
|
10
|
+
self.timeout = timeout
|
|
11
|
+
|
|
12
|
+
def _headers(self):
|
|
13
|
+
return {
|
|
14
|
+
"X-Mocol-Key": self.api_key,
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def _request(self, method: str, path: str, json_data=None):
|
|
19
|
+
try:
|
|
20
|
+
res = requests.request(
|
|
21
|
+
method=method,
|
|
22
|
+
url=self.api_url + path,
|
|
23
|
+
headers=self._headers(),
|
|
24
|
+
json=json_data,
|
|
25
|
+
timeout=self.timeout,
|
|
26
|
+
)
|
|
27
|
+
except requests.RequestException as e:
|
|
28
|
+
raise MocolDaikoError(str(e))
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
data = res.json()
|
|
32
|
+
except Exception:
|
|
33
|
+
data = {"text": res.text}
|
|
34
|
+
|
|
35
|
+
if res.status_code >= 400:
|
|
36
|
+
raise MocolDaikoError({
|
|
37
|
+
"status_code": res.status_code,
|
|
38
|
+
"response": data,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return data
|
|
42
|
+
|
|
43
|
+
def health(self):
|
|
44
|
+
return self._request("GET", "/health")
|
|
45
|
+
|
|
46
|
+
def list_ids(self):
|
|
47
|
+
return self._request("GET", "/v1/daiko/ids")
|
|
48
|
+
|
|
49
|
+
def status(self, daiko_id: str):
|
|
50
|
+
return self._request("GET", f"/v1/daiko/{daiko_id}/status")
|
|
51
|
+
|
|
52
|
+
def get_usage(self, email: str):
|
|
53
|
+
return self._request("GET", f"/v1/usage/{email}")
|
|
54
|
+
|
|
55
|
+
def check_usage(self, email: str, coin: int):
|
|
56
|
+
return self._request(
|
|
57
|
+
"POST",
|
|
58
|
+
"/v1/usage/check",
|
|
59
|
+
{
|
|
60
|
+
"email": email,
|
|
61
|
+
"coin": coin,
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
def coin(
|
|
66
|
+
self,
|
|
67
|
+
daiko_id: str,
|
|
68
|
+
email: str,
|
|
69
|
+
coin: int,
|
|
70
|
+
tsum_id: str | None = None,
|
|
71
|
+
wait: bool = True,
|
|
72
|
+
delete_after: bool = False,
|
|
73
|
+
):
|
|
74
|
+
payload = {
|
|
75
|
+
"email": email,
|
|
76
|
+
"coin": coin,
|
|
77
|
+
"wait": wait,
|
|
78
|
+
"delete_after": delete_after,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if tsum_id:
|
|
82
|
+
payload["tsum_id"] = tsum_id
|
|
83
|
+
|
|
84
|
+
return self._request(
|
|
85
|
+
"POST",
|
|
86
|
+
f"/v1/daiko/{daiko_id}/coin",
|
|
87
|
+
payload,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
def delete_account(self, unique_id: str):
|
|
91
|
+
return self._request(
|
|
92
|
+
"POST",
|
|
93
|
+
f"/v1/daiko/account/{unique_id}/delete",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def start_line_login(
|
|
97
|
+
self,
|
|
98
|
+
email: str,
|
|
99
|
+
password: str,
|
|
100
|
+
):
|
|
101
|
+
return self._request(
|
|
102
|
+
"POST",
|
|
103
|
+
"/v1/auth/start",
|
|
104
|
+
{
|
|
105
|
+
"email": email,
|
|
106
|
+
"password": password,
|
|
107
|
+
},
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
def line_login_status(
|
|
111
|
+
self,
|
|
112
|
+
unique_id: str,
|
|
113
|
+
):
|
|
114
|
+
return self._request(
|
|
115
|
+
"GET",
|
|
116
|
+
f"/v1/auth/status/{unique_id}",
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def line_login_ids(
|
|
120
|
+
self,
|
|
121
|
+
unique_id: str,
|
|
122
|
+
):
|
|
123
|
+
return self._request(
|
|
124
|
+
"GET",
|
|
125
|
+
f"/v1/auth/ids/{unique_id}",
|
|
126
|
+
)
|
|
127
|
+
def send_captcha(
|
|
128
|
+
self,
|
|
129
|
+
unique_id: str,
|
|
130
|
+
answer: str,
|
|
131
|
+
):
|
|
132
|
+
return self._request(
|
|
133
|
+
"POST",
|
|
134
|
+
f"/v1/auth/captcha/{unique_id}",
|
|
135
|
+
{
|
|
136
|
+
"answer": answer,
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def download_captcha(
|
|
141
|
+
self,
|
|
142
|
+
unique_id: str,
|
|
143
|
+
filename: str = "captcha.png",
|
|
144
|
+
):
|
|
145
|
+
url = self.api_url + f"/v1/auth/captcha/{unique_id}.png"
|
|
146
|
+
|
|
147
|
+
try:
|
|
148
|
+
res = requests.get(
|
|
149
|
+
url,
|
|
150
|
+
headers={
|
|
151
|
+
"X-Mocol-Key": self.api_key,
|
|
152
|
+
},
|
|
153
|
+
timeout=self.timeout,
|
|
154
|
+
)
|
|
155
|
+
except requests.RequestException as e:
|
|
156
|
+
raise MocolDaikoError(str(e))
|
|
157
|
+
|
|
158
|
+
if res.status_code >= 400:
|
|
159
|
+
raise MocolDaikoError({
|
|
160
|
+
"status_code": res.status_code,
|
|
161
|
+
"text": res.text,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
with open(filename, "wb") as f:
|
|
165
|
+
f.write(res.content)
|
|
166
|
+
|
|
167
|
+
return filename
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mocoldtt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Mocol Daiko API SDK for Discord bots
|
|
5
|
+
Author: Mocol
|
|
6
|
+
Project-URL: Homepage, https://m0col.com
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: requests>=2.31.0
|
|
10
|
+
|
|
11
|
+
# mocol-daiko-sdk
|
|
12
|
+
|
|
13
|
+
Mocol Daiko API SDK.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install mocol-daiko-sdk
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
mocoldtt/__init__.py
|
|
4
|
+
mocoldtt/client.py
|
|
5
|
+
mocoldtt/exceptions.py
|
|
6
|
+
mocoldtt.egg-info/PKG-INFO
|
|
7
|
+
mocoldtt.egg-info/SOURCES.txt
|
|
8
|
+
mocoldtt.egg-info/dependency_links.txt
|
|
9
|
+
mocoldtt.egg-info/requires.txt
|
|
10
|
+
mocoldtt.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.31.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mocoldtt
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mocoldtt"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Mocol Daiko API SDK for Discord bots"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"requests>=2.31.0"
|
|
13
|
+
]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Mocol" }
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://m0col.com"
|
mocoldtt-0.1.0/setup.cfg
ADDED