hyperping 0.1.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.
- hyperping/__init__.py +151 -0
- hyperping/_incidents_mixin.py +198 -0
- hyperping/_maintenance_mixin.py +195 -0
- hyperping/_monitors_mixin.py +250 -0
- hyperping/_outages_mixin.py +102 -0
- hyperping/_statuspages_mixin.py +226 -0
- hyperping/_version.py +1 -0
- hyperping/client.py +452 -0
- hyperping/endpoints.py +231 -0
- hyperping/exceptions.py +89 -0
- hyperping/models.py +769 -0
- hyperping/py.typed +0 -0
- hyperping-0.1.0.dist-info/METADATA +223 -0
- hyperping-0.1.0.dist-info/RECORD +16 -0
- hyperping-0.1.0.dist-info/WHEEL +4 -0
- hyperping-0.1.0.dist-info/licenses/LICENSE +21 -0
hyperping/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hyperping
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Hyperping uptime monitoring and incident management API
|
|
5
|
+
Project-URL: Homepage, https://github.com/develeap/hyperping-python
|
|
6
|
+
Project-URL: Documentation, https://github.com/develeap/hyperping-python#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/develeap/hyperping-python
|
|
8
|
+
Project-URL: Changelog, https://github.com/develeap/hyperping-python/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/develeap/hyperping-python/issues
|
|
10
|
+
Author-email: Develeap <dev@develeap.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: api-client,hyperping,incident,monitoring,status-page,uptime
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: httpx>=0.26
|
|
27
|
+
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
30
|
+
Requires-Dist: pydantic; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
34
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# hyperping
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/hyperping/)
|
|
40
|
+
[](https://pypi.org/project/hyperping/)
|
|
41
|
+
[](https://github.com/develeap/hyperping-python/actions/workflows/ci.yml)
|
|
42
|
+
[](https://codecov.io/gh/develeap/hyperping-python)
|
|
43
|
+
[](https://github.com/astral-sh/ruff)
|
|
44
|
+
[](https://mypy-lang.org/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
|
|
47
|
+
Python SDK for the [Hyperping](https://hyperping.io) uptime monitoring and incident management API.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install hyperping
|
|
53
|
+
# or
|
|
54
|
+
uv add hyperping
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from hyperping import HyperpingClient, IncidentCreate, LocalizedText
|
|
61
|
+
|
|
62
|
+
with HyperpingClient(api_key="sk_...") as client:
|
|
63
|
+
# List all monitors
|
|
64
|
+
monitors = client.list_monitors()
|
|
65
|
+
for m in monitors:
|
|
66
|
+
print(f"{m.name}: {'down' if m.down else 'up'}")
|
|
67
|
+
|
|
68
|
+
# Open an incident
|
|
69
|
+
incident = client.create_incident(
|
|
70
|
+
IncidentCreate(
|
|
71
|
+
title=LocalizedText(en="Service degradation"),
|
|
72
|
+
text=LocalizedText(en="Investigating elevated error rates"),
|
|
73
|
+
statuspages=["sp_your_uuid"],
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Resolve it
|
|
78
|
+
client.resolve_incident(incident.uuid, "All systems operational")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Authentication
|
|
82
|
+
|
|
83
|
+
Pass your API key directly or via environment variable:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import os
|
|
87
|
+
from hyperping import HyperpingClient
|
|
88
|
+
|
|
89
|
+
# Constructor param
|
|
90
|
+
client = HyperpingClient(api_key="sk_...")
|
|
91
|
+
|
|
92
|
+
# From environment
|
|
93
|
+
client = HyperpingClient(api_key=os.environ["HYPERPING_API_KEY"])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Resources
|
|
97
|
+
|
|
98
|
+
### Monitors
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
monitors = client.list_monitors()
|
|
102
|
+
monitor = client.get_monitor("mon_uuid")
|
|
103
|
+
created = client.create_monitor(MonitorCreate(name="API", url="https://api.example.com"))
|
|
104
|
+
client.pause_monitor("mon_uuid")
|
|
105
|
+
client.resume_monitor("mon_uuid")
|
|
106
|
+
client.delete_monitor("mon_uuid")
|
|
107
|
+
|
|
108
|
+
# Reports
|
|
109
|
+
reports = client.get_all_reports(period="30d")
|
|
110
|
+
report = client.get_monitor_report("mon_uuid", period="7d")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Incidents
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
incidents = client.list_incidents()
|
|
117
|
+
incident = client.get_incident("inci_uuid")
|
|
118
|
+
created = client.create_incident(IncidentCreate(...))
|
|
119
|
+
client.add_incident_update("inci_uuid", AddIncidentUpdateRequest(...))
|
|
120
|
+
client.resolve_incident("inci_uuid", "Fixed")
|
|
121
|
+
client.delete_incident("inci_uuid")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Maintenance Windows
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
windows = client.list_maintenance()
|
|
128
|
+
window = client.get_maintenance("mw_uuid")
|
|
129
|
+
created = client.create_maintenance(MaintenanceCreate(...))
|
|
130
|
+
client.update_maintenance("mw_uuid", MaintenanceUpdate(name="New name"))
|
|
131
|
+
client.delete_maintenance("mw_uuid")
|
|
132
|
+
|
|
133
|
+
# Helpers
|
|
134
|
+
active = client.get_active_maintenance()
|
|
135
|
+
in_maint = client.is_monitor_in_maintenance("mon_uuid")
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Outages
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
outages = client.list_outages()
|
|
142
|
+
client.acknowledge_outage("out_uuid", message="On it")
|
|
143
|
+
client.resolve_outage("out_uuid", message="Fixed")
|
|
144
|
+
client.escalate_outage("out_uuid")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Status Pages
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
pages = client.list_status_pages(search="prod")
|
|
151
|
+
page = client.get_status_page("sp_uuid")
|
|
152
|
+
created = client.create_status_page(StatusPageCreate(name="Prod", subdomain="prod-status"))
|
|
153
|
+
client.update_status_page("sp_uuid", StatusPageUpdate(name="Production Status"))
|
|
154
|
+
client.delete_status_page("sp_uuid")
|
|
155
|
+
|
|
156
|
+
# Subscribers
|
|
157
|
+
subs = client.list_subscribers("sp_uuid")
|
|
158
|
+
sub = client.add_subscriber("sp_uuid", "user@example.com")
|
|
159
|
+
client.remove_subscriber("sp_uuid", sub.id)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Error Handling
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from hyperping import (
|
|
166
|
+
HyperpingAPIError,
|
|
167
|
+
HyperpingAuthError,
|
|
168
|
+
HyperpingNotFoundError,
|
|
169
|
+
HyperpingRateLimitError,
|
|
170
|
+
HyperpingValidationError,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
try:
|
|
174
|
+
monitor = client.get_monitor("mon_uuid")
|
|
175
|
+
except HyperpingNotFoundError:
|
|
176
|
+
print("Monitor not found")
|
|
177
|
+
except HyperpingRateLimitError as e:
|
|
178
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
179
|
+
except HyperpingAuthError:
|
|
180
|
+
print("Invalid API key")
|
|
181
|
+
except HyperpingAPIError as e:
|
|
182
|
+
print(f"API error [{e.status_code}]: {e.message}")
|
|
183
|
+
print(f"Request ID: {e.request_id}")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Retries and Circuit Breaker
|
|
187
|
+
|
|
188
|
+
The SDK retries automatically on transient errors (5xx, 429) with exponential backoff and jitter. A circuit breaker prevents cascading failures.
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from hyperping import HyperpingClient
|
|
192
|
+
from hyperping.client import RetryConfig, CircuitBreakerConfig
|
|
193
|
+
|
|
194
|
+
client = HyperpingClient(
|
|
195
|
+
api_key="sk_...",
|
|
196
|
+
retry_config=RetryConfig(
|
|
197
|
+
max_retries=3,
|
|
198
|
+
initial_delay=1.0,
|
|
199
|
+
max_delay=30.0,
|
|
200
|
+
backoff_factor=2.0,
|
|
201
|
+
),
|
|
202
|
+
circuit_breaker_config=CircuitBreakerConfig(
|
|
203
|
+
failure_threshold=5,
|
|
204
|
+
recovery_timeout=60.0,
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Type Safety
|
|
210
|
+
|
|
211
|
+
This package ships a `py.typed` marker (PEP 561) and is fully typed. Works out of the box with mypy and pyright.
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
MIT — see [LICENSE](LICENSE).
|
|
220
|
+
|
|
221
|
+
## Maintained by
|
|
222
|
+
|
|
223
|
+
[Develeap](https://develeap.com)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
hyperping/__init__.py,sha256=FRUfQfT1dnGtTJ3wWvyDR7vD4mC7d4xVFqniMV09L9E,3284
|
|
2
|
+
hyperping/_incidents_mixin.py,sha256=tdhu2SauMBcXYaB2cQaV-Y2lNwanO32cUgK7prbnWgQ,6514
|
|
3
|
+
hyperping/_maintenance_mixin.py,sha256=VeEcBqrsF5d9nmQ9f2LqKcLus-3TOoGtIU7UaevqJyg,6500
|
|
4
|
+
hyperping/_monitors_mixin.py,sha256=0NJSoApejA2JsFzqSWhDy8E8V2Z5RNd62cG1sm3Ibec,7642
|
|
5
|
+
hyperping/_outages_mixin.py,sha256=lBvQvz98KSQEl-93O0stX3hf3yvY5NQrPnylO-qt-DM,3030
|
|
6
|
+
hyperping/_statuspages_mixin.py,sha256=yB9HR4nyptVYtT7VUeD-sb0Yv7dixryaDqqE9GLAN74,7133
|
|
7
|
+
hyperping/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
8
|
+
hyperping/client.py,sha256=LS_gLY9Wv7Ti6VSie_u8ALrOxlRy8oXK8wKraOQLMPo,16322
|
|
9
|
+
hyperping/endpoints.py,sha256=7caQ1Sg7HC1CRU6YLfOZg2MaCZ66O20vAZa2rf54dgg,7391
|
|
10
|
+
hyperping/exceptions.py,sha256=h-HPxD3YehmarUsA5kbhVQmKaAt4FMikkv1hubvzITU,2637
|
|
11
|
+
hyperping/models.py,sha256=BtWJgSlXvl7qcGIALdh0jcIKn-FVQnvvKT3sDmUDUiQ,25712
|
|
12
|
+
hyperping/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
hyperping-0.1.0.dist-info/METADATA,sha256=LuFf9h5o7MaFULq4xICPoxSA-RxGG-r6ebJqON4a5Yw,6908
|
|
14
|
+
hyperping-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
15
|
+
hyperping-0.1.0.dist-info/licenses/LICENSE,sha256=pvB2D2XndvHitDkGdap2LbX_xHULlj3wOBFIJ_oZIMM,1065
|
|
16
|
+
hyperping-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Develeap
|
|
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.
|