libentry 1.11.11__py3-none-any.whl → 1.11.12__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.
- libentry/api.py +5 -5
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/METADATA +11 -1
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/RECORD +7 -7
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/LICENSE +0 -0
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/WHEEL +0 -0
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/top_level.txt +0 -0
- {libentry-1.11.11.dist-info → libentry-1.11.12.dist-info}/zip-safe +0 -0
libentry/api.py
CHANGED
@@ -170,8 +170,8 @@ class APIClient:
|
|
170
170
|
|
171
171
|
def __init__(
|
172
172
|
self,
|
173
|
-
base_url: str,
|
174
|
-
api_key: str = None,
|
173
|
+
base_url: Optional[str] = None,
|
174
|
+
api_key: Optional[str] = None,
|
175
175
|
accept: str = "application/json",
|
176
176
|
content_type: str = "application/json",
|
177
177
|
user_agent: str = "API Client",
|
@@ -219,10 +219,10 @@ class APIClient:
|
|
219
219
|
retry_factor: float = 2,
|
220
220
|
timeout: float = 15
|
221
221
|
):
|
222
|
-
|
222
|
+
full_url = urljoin(self.base_url, path) if self.base_url else path
|
223
223
|
response = self._request(
|
224
224
|
"get",
|
225
|
-
url=
|
225
|
+
url=full_url,
|
226
226
|
headers=self.headers,
|
227
227
|
verify=self.verify,
|
228
228
|
num_trials=num_trials,
|
@@ -254,7 +254,7 @@ class APIClient:
|
|
254
254
|
chunk_suffix: str = None,
|
255
255
|
error_prefix: str = "ERROR: "
|
256
256
|
):
|
257
|
-
full_url = urljoin(self.base_url, path)
|
257
|
+
full_url = urljoin(self.base_url, path) if self.base_url else path
|
258
258
|
|
259
259
|
headers = {**self.headers}
|
260
260
|
headers["Accept"] = headers["Accept"] + f"; stream={int(stream)}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: libentry
|
3
|
-
Version: 1.11.
|
3
|
+
Version: 1.11.12
|
4
4
|
Summary: Entries for experimental utilities.
|
5
5
|
Home-page: https://github.com/XoriieInpottn/libentry
|
6
6
|
Author: xi
|
@@ -18,5 +18,15 @@ Requires-Dist: requests
|
|
18
18
|
|
19
19
|
# libentry
|
20
20
|
|
21
|
+
## Define a Service Class
|
22
|
+
1. Define a normal python class.
|
23
|
+
2. Use @api.post() or @api.get() to tag a method as API method.
|
24
|
+
3. Ensure every API method has type hint for both arguments and return value.
|
25
|
+
|
26
|
+
## Access a Service
|
27
|
+
1. Create an APIClient instance.
|
28
|
+
2. Use its post() or get() method to send the request.
|
29
|
+
|
30
|
+
|
21
31
|
|
22
32
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
libentry/__init__.py,sha256=rDBip9M1Xb1N4wMKE1ni_DldrQbkRjp8DxPkTp3K2qo,170
|
2
|
-
libentry/api.py,sha256=
|
2
|
+
libentry/api.py,sha256=OZ-KZvSV2sWHshYB6vgS-qIu1P6bdfqcMCrOQs-_RwA,10114
|
3
3
|
libentry/argparse.py,sha256=NxzXV-jBN51ReZsNs5aeyOfzwYQ5A5nJ95rWoa-FYCs,10415
|
4
4
|
libentry/dataclasses.py,sha256=AQV2PuxplJCwGZ5HKX72U-z-POUhTdy3XtpEK9KNIGQ,4541
|
5
5
|
libentry/executor.py,sha256=cTV0WxJi0nU1TP-cOwmeodN8DD6L1691M2HIQsJtGrU,6582
|
@@ -14,9 +14,9 @@ libentry/service/list.py,sha256=ElHWhTgShGOhaxMUEwVbMXos0NQKjHsODboiQ-3AMwE,1397
|
|
14
14
|
libentry/service/running.py,sha256=FrPJoJX6wYxcHIysoatAxhW3LajCCm0Gx6l7__6sULQ,5105
|
15
15
|
libentry/service/start.py,sha256=mZT7b9rVULvzy9GTZwxWnciCHgv9dbGN2JbxM60OMn4,1270
|
16
16
|
libentry/service/stop.py,sha256=wOpwZgrEJ7QirntfvibGq-XsTC6b3ELhzRW2zezh-0s,1187
|
17
|
-
libentry-1.11.
|
18
|
-
libentry-1.11.
|
19
|
-
libentry-1.11.
|
20
|
-
libentry-1.11.
|
21
|
-
libentry-1.11.
|
22
|
-
libentry-1.11.
|
17
|
+
libentry-1.11.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
18
|
+
libentry-1.11.12.dist-info/METADATA,sha256=GLIiUoxHfO_byVbTFbyBMar-S8ywTkGzZR_tQpRBmII,794
|
19
|
+
libentry-1.11.12.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
20
|
+
libentry-1.11.12.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
|
21
|
+
libentry-1.11.12.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
22
|
+
libentry-1.11.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|