js-api 0.3.0__tar.gz → 0.3.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 (30) hide show
  1. {js_api-0.3.0 → js_api-0.3.1}/PKG-INFO +1 -1
  2. {js_api-0.3.0 → js_api-0.3.1}/pyproject.toml +1 -1
  3. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/webhook.py +21 -2
  4. {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/PKG-INFO +1 -1
  5. {js_api-0.3.0 → js_api-0.3.1}/LICENSE +0 -0
  6. {js_api-0.3.0 → js_api-0.3.1}/README.md +0 -0
  7. {js_api-0.3.0 → js_api-0.3.1}/setup.cfg +0 -0
  8. {js_api-0.3.0 → js_api-0.3.1}/src/__init__.py +0 -0
  9. {js_api-0.3.0 → js_api-0.3.1}/src/api.py +0 -0
  10. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/__init__.py +0 -0
  11. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/docker.py +0 -0
  12. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/health_check.py +0 -0
  13. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/ip.py +0 -0
  14. {js_api-0.3.0 → js_api-0.3.1}/src/controllers/valentines_day.py +0 -0
  15. {js_api-0.3.0 → js_api-0.3.1}/src/database.py +0 -0
  16. {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/SOURCES.txt +0 -0
  17. {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/dependency_links.txt +0 -0
  18. {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/requires.txt +0 -0
  19. {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/top_level.txt +0 -0
  20. {js_api-0.3.0 → js_api-0.3.1}/src/models.py +0 -0
  21. {js_api-0.3.0 → js_api-0.3.1}/src/util/__init__.py +0 -0
  22. {js_api-0.3.0 → js_api-0.3.1}/src/util/auth.py +0 -0
  23. {js_api-0.3.0 → js_api-0.3.1}/src/util/docker.py +0 -0
  24. {js_api-0.3.0 → js_api-0.3.1}/src/util/healthcheck.py +0 -0
  25. {js_api-0.3.0 → js_api-0.3.1}/src/util/logging.py +0 -0
  26. {js_api-0.3.0 → js_api-0.3.1}/src/util/mail.py +0 -0
  27. {js_api-0.3.0 → js_api-0.3.1}/tests/test_docker.py +0 -0
  28. {js_api-0.3.0 → js_api-0.3.1}/tests/test_health_check.py +0 -0
  29. {js_api-0.3.0 → js_api-0.3.1}/tests/test_ip.py +0 -0
  30. {js_api-0.3.0 → js_api-0.3.1}/tests/test_webhook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: js-api
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Custom API written in Python using FastAPI
5
5
  Author-email: Jack Stockley <jack@jstockley.com>
6
6
  Project-URL: Homepage, https://github.com/jnstockley/api
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "js-api"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Custom API written in Python using FastAPI"
5
5
  authors = [
6
6
  {name = "Jack Stockley", email = "jack@jstockley.com"}
@@ -96,14 +96,33 @@ async def pve_ups(webhook: PveUpsWebhook):
96
96
  sender_addr="PVE UPS <no-reply@jstockley.com>",
97
97
  template="pve_ups_email.html",
98
98
  subject=webhook.subject,
99
- to=webhook.to,
99
+ to=[webhook.to],
100
100
  context={
101
101
  "body": webhook.body,
102
102
  "subject": webhook.subject,
103
- "facts": webhook.facts,
103
+ "facts": parse_facts(webhook.facts),
104
104
  "timestamp": webhook.timestamp,
105
105
  "severity": webhook.severity,
106
106
  "severity_upper": webhook.severity.upper(),
107
107
  "version": webhook.version,
108
108
  },
109
109
  )
110
+
111
+ return {"status": "sent"}
112
+
113
+
114
+ def parse_facts(facts_text: str) -> list[dict]:
115
+ """Turn PVE-UPS's rendered 'facts' string into {label, value} rows."""
116
+ facts = []
117
+ for line in facts_text.splitlines():
118
+ line = line.strip()
119
+ if not line:
120
+ continue
121
+ if ":" in line:
122
+ label, _, value = line.partition(":")
123
+ facts.append({"label": label.strip(), "value": value.strip()})
124
+ else:
125
+ facts.append(
126
+ {"label": "", "value": line}
127
+ ) # no colon: show it anyway, don't drop it
128
+ return facts
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: js-api
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Custom API written in Python using FastAPI
5
5
  Author-email: Jack Stockley <jack@jstockley.com>
6
6
  Project-URL: Homepage, https://github.com/jnstockley/api
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes