uptimer-python-sdk 0.2.0__py3-none-any.whl → 0.3.0__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.
uptimer/client.py CHANGED
@@ -9,8 +9,8 @@ from uptimer.http import UptimerHttpLib
9
9
  class UptimerClient:
10
10
  v1: V1Endpoint
11
11
 
12
- def __init__(self, api_key: str, base_url: str | None = None):
13
- self.set_uptimer_http_lib(UptimerHttpLib(api_key, base_url))
12
+ def __init__(self, api_key: str, base_url: str):
13
+ self._http_lib = UptimerHttpLib(api_key, base_url)
14
14
  self.v1 = V1Endpoint(self._http_lib)
15
15
 
16
16
  def version(self) -> str:
@@ -19,3 +19,8 @@ class UptimerClient:
19
19
 
20
20
  def set_uptimer_http_lib(self, http_lib: UptimerHttpLib) -> None:
21
21
  self._http_lib = http_lib
22
+
23
+
24
+ class UptimerCloudClient(UptimerClient):
25
+ def __init__(self, api_key: str):
26
+ super().__init__(api_key, "https://api.myuptime.info")
uptimer/http.py CHANGED
@@ -13,10 +13,7 @@ class WorkspacesEndpoint(BaseEndpoint):
13
13
 
14
14
 
15
15
  class UptimerHttpLib:
16
- def __init__(self, api_key: str, base_url: str | None = None):
17
- if base_url is None:
18
- base_url = "https://api.uptimer.com"
19
-
16
+ def __init__(self, api_key: str, base_url: str):
20
17
  self._base_url = base_url.rstrip("/")
21
18
  self._http_client = httpx.Client(
22
19
  base_url=base_url,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uptimer-python-sdk
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A Python SDK for uptimer
5
5
  Project-URL: Repository, https://github.com/myuptime-info/uptimer-python-sdk
6
6
  Author-email: Roman Zadoev <zadoev@gmail.com>
@@ -13,7 +13,11 @@ Description-Content-Type: text/markdown
13
13
 
14
14
  # Uptimer Python SDK
15
15
 
16
- A Python SDK for [uptimer](https://uptimer.myuptime.info/) - a monitoring and uptime checking service.
16
+ ![Uptimer](https://static.myuptime.info/61uvxp/icon.png)
17
+
18
+ A Python SDK for uptimer - a monitoring and uptime checking service.
19
+ * [uptimer self-hosted](https://uptimer.myuptime.info)
20
+ * [myuptime.info](https://myuptime.info)
17
21
 
18
22
  ## License
19
23
 
@@ -21,8 +25,40 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
21
25
 
22
26
  For third-party license information, see the [NOTICE](NOTICE) file.
23
27
 
28
+ ## Installation
29
+
30
+ ```shell
31
+ pip install uptimer-python-sdk
32
+ ```
33
+
34
+ or
35
+ ```shell
36
+ uv add uptimer-python-sdk
37
+ ```
38
+
24
39
  ## Usage
25
40
 
41
+ ### Create client
42
+
43
+ #### self-hosted
44
+
45
+ ```python
46
+ from uptimer.client import UptimerClient
47
+ client = UptimerClient(
48
+ api_key="your-api-key-here",
49
+ base_url="http://127.0.0.1:2517/api", # or your custom base URL
50
+ )
51
+ ```
52
+
53
+ #### cloud
54
+ ```python
55
+ from uptimer.client import UptimerCloudClient
56
+ client = UptimerCloudClient(
57
+ api_key="your-api-key-here",
58
+ )
59
+ ```
60
+
61
+ ### Basic example
26
62
  ```python
27
63
  from uptimer.client import UptimerClient
28
64
  from uptimer.models.rule import CreateRuleRequest, RuleRequest, RuleResponse, RuleResponseBody
@@ -1,7 +1,7 @@
1
1
  uptimer/__init__.py,sha256=xPKvxeYbWVTJxqdgCWKJV6_t24PlvBGs0qn6SiuAGAk,49
2
- uptimer/client.py,sha256=VCjXlg4xvbhBVD3iA_rOU1jr_qTcKYSdd_ZmA9yorUQ,664
2
+ uptimer/client.py,sha256=zGDZxtTa-1Nb1tlOMFQ23b6RdmX2YiyDdEJhOxHE9Ys,784
3
3
  uptimer/errors.py,sha256=ttei31pQhKnozY4xbDh3oMQEh3s8tNj4z6ed0_Htwkk,699
4
- uptimer/http.py,sha256=fKFZzsol6SuD1RvgRKds7VqKksbK-KEJN7Yqt5i_02E,1369
4
+ uptimer/http.py,sha256=CJ2H_UUObWZm988v5h8997-AEeFIT2Qu4tzM3DanQfo,1276
5
5
  uptimer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  uptimer/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  uptimer/endpoints/endpoint.py,sha256=TLITtDy4C-Mqs7dWnL3TYwyaoR2HnjqnCT_rTqI7T-s,917
@@ -15,8 +15,8 @@ uptimer/models/errors.py,sha256=xuKwRpX-MQjWggJYsqaM4p0bcvRLDKuWbCmH0JdpOQs,1299
15
15
  uptimer/models/region.py,sha256=PEZpXXDaoF884dfiIYfHBh1Akmr0fhjODtqVcXDzQYM,282
16
16
  uptimer/models/rule.py,sha256=ZzLpPBeOH0Qtl-bw9Jk_z_VvKnsUu6EEDKgvLZ-mCR4,1346
17
17
  uptimer/models/workspace.py,sha256=zxD05PuNcnGBBqB42X_qRGG_oqxDuW-iTafereiw5Q4,259
18
- uptimer_python_sdk-0.2.0.dist-info/METADATA,sha256=S1_QtLhnEW3yR4K3dhT_2fqghliicPM_SXS-qN0Grtg,4732
19
- uptimer_python_sdk-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- uptimer_python_sdk-0.2.0.dist-info/licenses/LICENSE,sha256=f5hNPk9nMiFFcs8hvC1uy5erybWlFm-7iHCOJd4HATc,1069
21
- uptimer_python_sdk-0.2.0.dist-info/licenses/NOTICE,sha256=gimzxqrDPQ8cq3bH6aXBkuoPek6DbQwKS6Ix56F1CR4,1628
22
- uptimer_python_sdk-0.2.0.dist-info/RECORD,,
18
+ uptimer_python_sdk-0.3.0.dist-info/METADATA,sha256=Z5_fhb-gf0orYgi_MYXXMU_RZ3LrCzef6sMlipmF20M,5336
19
+ uptimer_python_sdk-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ uptimer_python_sdk-0.3.0.dist-info/licenses/LICENSE,sha256=f5hNPk9nMiFFcs8hvC1uy5erybWlFm-7iHCOJd4HATc,1069
21
+ uptimer_python_sdk-0.3.0.dist-info/licenses/NOTICE,sha256=gimzxqrDPQ8cq3bH6aXBkuoPek6DbQwKS6Ix56F1CR4,1628
22
+ uptimer_python_sdk-0.3.0.dist-info/RECORD,,