hyperping 1.1.0__tar.gz → 1.2.1__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.
Files changed (51) hide show
  1. {hyperping-1.1.0 → hyperping-1.2.1}/PKG-INFO +2 -2
  2. {hyperping-1.1.0 → hyperping-1.2.1}/pyproject.toml +2 -2
  3. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_incidents_mixin.py +11 -1
  4. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_maintenance_mixin.py +5 -6
  5. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_outages_mixin.py +63 -0
  6. hyperping-1.2.1/src/hyperping/_version.py +1 -0
  7. hyperping-1.1.0/src/hyperping/_version.py +0 -1
  8. {hyperping-1.1.0 → hyperping-1.2.1}/.gitignore +0 -0
  9. {hyperping-1.1.0 → hyperping-1.2.1}/CHANGELOG.md +0 -0
  10. {hyperping-1.1.0 → hyperping-1.2.1}/CONTRIBUTING.md +0 -0
  11. {hyperping-1.1.0 → hyperping-1.2.1}/LICENSE +0 -0
  12. {hyperping-1.1.0 → hyperping-1.2.1}/README.md +0 -0
  13. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/__init__.py +0 -0
  14. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_client.py +0 -0
  15. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_healthchecks_mixin.py +0 -0
  16. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_incidents_mixin.py +0 -0
  17. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_maintenance_mixin.py +0 -0
  18. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_monitors_mixin.py +0 -0
  19. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_outages_mixin.py +0 -0
  20. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_async_statuspages_mixin.py +0 -0
  21. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_circuit_breaker.py +0 -0
  22. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_healthchecks_mixin.py +0 -0
  23. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_internals.py +0 -0
  24. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_monitor_constants.py +0 -0
  25. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_monitors_mixin.py +0 -0
  26. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_protocols.py +0 -0
  27. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_statuspages_mixin.py +0 -0
  28. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/_utils.py +0 -0
  29. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/client.py +0 -0
  30. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/endpoints.py +0 -0
  31. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/exceptions.py +0 -0
  32. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/__init__.py +0 -0
  33. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_healthcheck_models.py +0 -0
  34. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_incident_models.py +0 -0
  35. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_maintenance_models.py +0 -0
  36. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_monitor_models.py +0 -0
  37. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_outage_models.py +0 -0
  38. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/models/_statuspage_models.py +0 -0
  39. {hyperping-1.1.0 → hyperping-1.2.1}/src/hyperping/py.typed +0 -0
  40. {hyperping-1.1.0 → hyperping-1.2.1}/tests/__init__.py +0 -0
  41. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/__init__.py +0 -0
  42. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/conftest.py +0 -0
  43. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_async_client.py +0 -0
  44. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_healthchecks.py +0 -0
  45. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_incidents.py +0 -0
  46. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_maintenance.py +0 -0
  47. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_monitors.py +0 -0
  48. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_outages.py +0 -0
  49. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_pagination.py +0 -0
  50. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_sdk_surface.py +0 -0
  51. {hyperping-1.1.0 → hyperping-1.2.1}/tests/unit/test_statuspages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperping
3
- Version: 1.1.0
3
+ Version: 1.2.1
4
4
  Summary: Python SDK for the Hyperping uptime monitoring and incident management API
5
5
  Project-URL: Homepage, https://github.com/develeap/hyperping-python
6
6
  Project-URL: Documentation, https://github.com/develeap/hyperping-python#readme
@@ -30,7 +30,7 @@ Requires-Dist: mypy>=1.10; extra == 'dev'
30
30
  Requires-Dist: pip-audit>=2.7; extra == 'dev'
31
31
  Requires-Dist: pydantic; extra == 'dev'
32
32
  Requires-Dist: pytest-cov; extra == 'dev'
33
- Requires-Dist: pytest>=8.0; extra == 'dev'
33
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
34
34
  Requires-Dist: respx>=0.21; extra == 'dev'
35
35
  Requires-Dist: ruff>=0.4; extra == 'dev'
36
36
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hyperping"
7
- version = "1.1.0"
7
+ version = "1.2.1"
8
8
  description = "Python SDK for the Hyperping uptime monitoring and incident management API"
9
9
  readme = {file = "README.md", content-type = "text/markdown"}
10
10
  license = {text = "MIT"}
@@ -31,7 +31,7 @@ dependencies = [
31
31
 
32
32
  [project.optional-dependencies]
33
33
  dev = [
34
- "pytest>=8.0",
34
+ "pytest>=9.0.3",
35
35
  "pytest-cov",
36
36
  "respx>=0.21",
37
37
  "ruff>=0.4",
@@ -12,6 +12,7 @@ from datetime import UTC, datetime
12
12
  from hyperping._protocols import _ClientProtocol
13
13
  from hyperping._utils import expect_dict, parse_list, unwrap_list, validate_id
14
14
  from hyperping.endpoints import Endpoint
15
+ from hyperping.exceptions import HyperpingAPIError
15
16
  from hyperping.models import (
16
17
  AddIncidentUpdateRequest, # canonical name (M18)
17
18
  Incident,
@@ -144,7 +145,16 @@ class IncidentsMixin(_ClientProtocol):
144
145
  payload = update.model_dump(exclude_none=True, by_alias=True)
145
146
  url = f"{Endpoint.INCIDENTS}/{incident_id}/updates"
146
147
  self._request("POST", url, json=payload) # Returns {"message": "..."} — not a full Incident
147
- return self.get_incident(incident_id)
148
+ try:
149
+ return self.get_incident(incident_id)
150
+ except HyperpingAPIError as exc:
151
+ raise HyperpingAPIError(
152
+ f"Incident update was posted successfully but refreshing "
153
+ f"incident {incident_id!r} failed: {exc}",
154
+ status_code=exc.status_code,
155
+ response_body=exc.response_body,
156
+ request_id=exc.request_id,
157
+ ) from exc
148
158
 
149
159
  def resolve_incident(self, incident_id: str, message: str | None = None) -> Incident:
150
160
  """Resolve an incident.
@@ -125,12 +125,11 @@ class MaintenanceMixin(_ClientProtocol):
125
125
  current = self.get_maintenance(maintenance_id)
126
126
  partial = update.model_dump(exclude_none=True, by_alias=True, mode="json")
127
127
 
128
- payload: dict[str, object] = {
129
- "name": current.name,
130
- "start_date": current.start_date,
131
- "end_date": current.end_date,
132
- "monitors": current.monitors,
133
- }
128
+ payload: dict[str, object] = current.model_dump(
129
+ mode="json",
130
+ exclude_none=True,
131
+ include={"name", "start_date", "end_date", "monitors"},
132
+ )
134
133
  payload.update(partial)
135
134
 
136
135
  response = expect_dict(
@@ -140,3 +140,66 @@ class OutagesMixin(_ClientProtocol):
140
140
  validate_id(outage_id, "outage_id") # H8
141
141
  result = self._request("POST", f"{Endpoint.OUTAGES}/{outage_id}/escalate")
142
142
  return OutageAction.from_raw(expect_dict(result, "outage operation"))
143
+
144
+ def unacknowledge_outage(self, outage_id: str) -> OutageAction:
145
+ """Unacknowledge an outage.
146
+
147
+ Args:
148
+ outage_id: Outage UUID.
149
+
150
+ Returns:
151
+ :class:`~hyperping.models.OutageAction` with the action result.
152
+
153
+ Raises:
154
+ HyperpingNotFoundError: If outage not found.
155
+ """
156
+ validate_id(outage_id, "outage_id") # H8
157
+ result = self._request(
158
+ "POST", f"{Endpoint.OUTAGES}/{outage_id}/unacknowledge"
159
+ )
160
+ return OutageAction.from_raw(expect_dict(result, "outage operation"))
161
+
162
+ def delete_outage(self, outage_id: str) -> None:
163
+ """Delete an outage.
164
+
165
+ Args:
166
+ outage_id: Outage UUID.
167
+
168
+ Raises:
169
+ HyperpingNotFoundError: If outage not found.
170
+ """
171
+ validate_id(outage_id, "outage_id") # H8
172
+ self._request("DELETE", f"{Endpoint.OUTAGES}/{outage_id}")
173
+
174
+ def create_outage(self, monitor_uuid: str) -> Outage:
175
+ """Create a manual outage for a monitor.
176
+
177
+ Args:
178
+ monitor_uuid: Monitor UUID to create the outage for.
179
+
180
+ Returns:
181
+ Created :class:`~hyperping.models.Outage` object.
182
+
183
+ Raises:
184
+ HyperpingValidationError: If the payload fails server-side validation.
185
+ HyperpingAPIError: On unexpected API errors.
186
+ """
187
+ payload = {"monitor_uuid": monitor_uuid}
188
+ result = self._request("POST", Endpoint.OUTAGES, json=payload)
189
+ return Outage.model_validate(expect_dict(result, "create_outage"))
190
+
191
+ def get_outage(self, outage_id: str) -> Outage:
192
+ """Get a single outage by ID.
193
+
194
+ Args:
195
+ outage_id: Outage UUID.
196
+
197
+ Returns:
198
+ :class:`~hyperping.models.Outage` object.
199
+
200
+ Raises:
201
+ HyperpingNotFoundError: If outage not found.
202
+ """
203
+ validate_id(outage_id, "outage_id") # H8
204
+ result = self._request("GET", f"{Endpoint.OUTAGES}/{outage_id}")
205
+ return Outage.model_validate(expect_dict(result, "get_outage"))
@@ -0,0 +1 @@
1
+ __version__ = "1.2.1"
@@ -1 +0,0 @@
1
- __version__ = "1.0.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes