js-api 0.3.0__tar.gz → 0.3.2__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.2}/PKG-INFO +3 -3
  2. {js_api-0.3.0 → js_api-0.3.2}/pyproject.toml +3 -3
  3. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/webhook.py +21 -2
  4. {js_api-0.3.0 → js_api-0.3.2}/src/js_api.egg-info/PKG-INFO +3 -3
  5. {js_api-0.3.0 → js_api-0.3.2}/src/js_api.egg-info/requires.txt +2 -2
  6. {js_api-0.3.0 → js_api-0.3.2}/LICENSE +0 -0
  7. {js_api-0.3.0 → js_api-0.3.2}/README.md +0 -0
  8. {js_api-0.3.0 → js_api-0.3.2}/setup.cfg +0 -0
  9. {js_api-0.3.0 → js_api-0.3.2}/src/__init__.py +0 -0
  10. {js_api-0.3.0 → js_api-0.3.2}/src/api.py +0 -0
  11. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/__init__.py +0 -0
  12. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/docker.py +0 -0
  13. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/health_check.py +0 -0
  14. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/ip.py +0 -0
  15. {js_api-0.3.0 → js_api-0.3.2}/src/controllers/valentines_day.py +0 -0
  16. {js_api-0.3.0 → js_api-0.3.2}/src/database.py +0 -0
  17. {js_api-0.3.0 → js_api-0.3.2}/src/js_api.egg-info/SOURCES.txt +0 -0
  18. {js_api-0.3.0 → js_api-0.3.2}/src/js_api.egg-info/dependency_links.txt +0 -0
  19. {js_api-0.3.0 → js_api-0.3.2}/src/js_api.egg-info/top_level.txt +0 -0
  20. {js_api-0.3.0 → js_api-0.3.2}/src/models.py +0 -0
  21. {js_api-0.3.0 → js_api-0.3.2}/src/util/__init__.py +0 -0
  22. {js_api-0.3.0 → js_api-0.3.2}/src/util/auth.py +0 -0
  23. {js_api-0.3.0 → js_api-0.3.2}/src/util/docker.py +0 -0
  24. {js_api-0.3.0 → js_api-0.3.2}/src/util/healthcheck.py +0 -0
  25. {js_api-0.3.0 → js_api-0.3.2}/src/util/logging.py +0 -0
  26. {js_api-0.3.0 → js_api-0.3.2}/src/util/mail.py +0 -0
  27. {js_api-0.3.0 → js_api-0.3.2}/tests/test_docker.py +0 -0
  28. {js_api-0.3.0 → js_api-0.3.2}/tests/test_health_check.py +0 -0
  29. {js_api-0.3.0 → js_api-0.3.2}/tests/test_ip.py +0 -0
  30. {js_api-0.3.0 → js_api-0.3.2}/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.2
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
@@ -11,10 +11,10 @@ Classifier: Programming Language :: Python :: 3
11
11
  Requires-Python: <4.0,>=3.14
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: fastapi[standard]==0.141.1
14
+ Requires-Dist: fastapi[standard]==0.142.2
15
15
  Requires-Dist: sqlalchemy==2.0.54
16
16
  Requires-Dist: sqlmodel==0.0.47
17
- Requires-Dist: python-dotenv==1.2.3
17
+ Requires-Dist: python-dotenv==1.2.4
18
18
  Requires-Dist: psycopg[binary]==3.3.6
19
19
  Requires-Dist: nctalk==0.0.4
20
20
  Requires-Dist: jinja2==3.1.6
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "js-api"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Custom API written in Python using FastAPI"
5
5
  authors = [
6
6
  {name = "Jack Stockley", email = "jack@jstockley.com"}
@@ -13,10 +13,10 @@ classifiers = [
13
13
  "Programming Language :: Python :: 3",
14
14
  ]
15
15
  dependencies = [
16
- "fastapi[standard]==0.141.1",
16
+ "fastapi[standard]==0.142.2",
17
17
  "sqlalchemy==2.0.54",
18
18
  "sqlmodel==0.0.47",
19
- "python-dotenv==1.2.3",
19
+ "python-dotenv==1.2.4",
20
20
  "psycopg[binary]==3.3.6",
21
21
  "nctalk==0.0.4",
22
22
  "jinja2==3.1.6",
@@ -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.2
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
@@ -11,10 +11,10 @@ Classifier: Programming Language :: Python :: 3
11
11
  Requires-Python: <4.0,>=3.14
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: fastapi[standard]==0.141.1
14
+ Requires-Dist: fastapi[standard]==0.142.2
15
15
  Requires-Dist: sqlalchemy==2.0.54
16
16
  Requires-Dist: sqlmodel==0.0.47
17
- Requires-Dist: python-dotenv==1.2.3
17
+ Requires-Dist: python-dotenv==1.2.4
18
18
  Requires-Dist: psycopg[binary]==3.3.6
19
19
  Requires-Dist: nctalk==0.0.4
20
20
  Requires-Dist: jinja2==3.1.6
@@ -1,7 +1,7 @@
1
- fastapi[standard]==0.141.1
1
+ fastapi[standard]==0.142.2
2
2
  sqlalchemy==2.0.54
3
3
  sqlmodel==0.0.47
4
- python-dotenv==1.2.3
4
+ python-dotenv==1.2.4
5
5
  psycopg[binary]==3.3.6
6
6
  nctalk==0.0.4
7
7
  jinja2==3.1.6
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