get-systems 0.2.45__tar.gz → 0.2.46__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.
- {get_systems-0.2.45 → get_systems-0.2.46}/PKG-INFO +7 -5
- {get_systems-0.2.45 → get_systems-0.2.46}/README.md +6 -4
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/http/http_block.py +1 -1
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/http/signing.py +28 -3
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/address.py +8 -1
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems.egg-info/PKG-INFO +7 -5
- {get_systems-0.2.45 → get_systems-0.2.46}/pyproject.toml +1 -1
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_address.py +29 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_signed_webhook.py +28 -8
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/azure_cu/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/azure_cu/blocks.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/http/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/http/signed_webhook.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/langfuse/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/langfuse/credentials.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/llm/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/llm/gpt_blocks.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/llm/utils.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/__init__.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/bank_account.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/base.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/ccase.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/communication.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/contact.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/contact_parser.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/event.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/file_aica.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/import_data.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/payment.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems/models/subcase.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems.egg-info/SOURCES.txt +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems.egg-info/dependency_links.txt +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems.egg-info/requires.txt +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/get_systems.egg-info/top_level.txt +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/setup.cfg +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_azure_cu.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_bank_account.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_base.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_client.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_comparison.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_contact.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_contact_parser.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_event.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_gs.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_import_data.py +0 -0
- {get_systems-0.2.45 → get_systems-0.2.46}/tests/test_langfuse_credentials.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: get-systems
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.46
|
|
4
4
|
Summary: Get Systems Prefect Blocks - Enterprise LLM and HTTP operations
|
|
5
5
|
Author: Get Systems
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -185,8 +185,9 @@ async def my_http_flow():
|
|
|
185
185
|
### Signing request bodies in `HttpBlock`
|
|
186
186
|
|
|
187
187
|
Set the optional `signing_secret` (`whsec_<base64>`) on `HttpBlock` and every
|
|
188
|
-
`request()` is signed per
|
|
189
|
-
`webhook-id`, `
|
|
188
|
+
`request()` is signed per the Hermes v2 scheme:
|
|
189
|
+
`webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2` (hex HMAC-SHA256 of
|
|
190
|
+
`<timestamp>.<body>`) headers are added and the
|
|
190
191
|
exact signed bytes are sent. Only `json=` and `content=` bodies are supported
|
|
191
192
|
(`data=`/`files=` raise `ValueError`).
|
|
192
193
|
|
|
@@ -203,8 +204,9 @@ the automation action "Call a webhook". It sends the request signed per the
|
|
|
203
204
|
|
|
204
205
|
Block fields: `url`, `method` (default `POST`), `headers`, `allow_private_urls`,
|
|
205
206
|
`verify` (as in `Webhook`) plus `secret` - the signing secret `whsec_<base64>`.
|
|
206
|
-
The block adds `webhook-id`, `
|
|
207
|
-
(
|
|
207
|
+
The block adds `webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2`
|
|
208
|
+
(hex HMAC-SHA256 of `<timestamp>.<body>`, Hermes v2; the standard-webhooks
|
|
209
|
+
`webhook-timestamp`/`webhook-signature` headers are not sent) headers and `content-type: application/json` (unless set). The
|
|
208
210
|
exact signed bytes are sent: a string payload is sent as-is, a dict as compact
|
|
209
211
|
JSON, `None` as an empty body.
|
|
210
212
|
|
|
@@ -148,8 +148,9 @@ async def my_http_flow():
|
|
|
148
148
|
### Signing request bodies in `HttpBlock`
|
|
149
149
|
|
|
150
150
|
Set the optional `signing_secret` (`whsec_<base64>`) on `HttpBlock` and every
|
|
151
|
-
`request()` is signed per
|
|
152
|
-
`webhook-id`, `
|
|
151
|
+
`request()` is signed per the Hermes v2 scheme:
|
|
152
|
+
`webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2` (hex HMAC-SHA256 of
|
|
153
|
+
`<timestamp>.<body>`) headers are added and the
|
|
153
154
|
exact signed bytes are sent. Only `json=` and `content=` bodies are supported
|
|
154
155
|
(`data=`/`files=` raise `ValueError`).
|
|
155
156
|
|
|
@@ -166,8 +167,9 @@ the automation action "Call a webhook". It sends the request signed per the
|
|
|
166
167
|
|
|
167
168
|
Block fields: `url`, `method` (default `POST`), `headers`, `allow_private_urls`,
|
|
168
169
|
`verify` (as in `Webhook`) plus `secret` - the signing secret `whsec_<base64>`.
|
|
169
|
-
The block adds `webhook-id`, `
|
|
170
|
-
(
|
|
170
|
+
The block adds `webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2`
|
|
171
|
+
(hex HMAC-SHA256 of `<timestamp>.<body>`, Hermes v2; the standard-webhooks
|
|
172
|
+
`webhook-timestamp`/`webhook-signature` headers are not sent) headers and `content-type: application/json` (unless set). The
|
|
171
173
|
exact signed bytes are sent: a string payload is sent as-is, a dict as compact
|
|
172
174
|
JSON, `None` as an empty body.
|
|
173
175
|
|
|
@@ -182,7 +182,7 @@ print(response.json())
|
|
|
182
182
|
title="Signing Secret",
|
|
183
183
|
description=(
|
|
184
184
|
"Optional Standard Webhooks secret (`whsec_<base64>`). When set, every "
|
|
185
|
-
"request body is signed (webhook-id /
|
|
185
|
+
"request body is signed (Hermes v2: webhook-id / X-Webhook-Timestamp / X-Webhook-Signature-V2)."
|
|
186
186
|
),
|
|
187
187
|
)
|
|
188
188
|
|
|
@@ -38,11 +38,36 @@ def serialize_payload(payload: dict[str, Any] | str | bytes | None) -> bytes:
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def build_signature_headers(body: bytes, secret: str) -> dict[str, str]:
|
|
41
|
-
"""Return ``webhook-id
|
|
41
|
+
"""Return Hermes v2 headers: ``webhook-id``, ``X-Webhook-Timestamp``, ``X-Webhook-Signature-V2``."""
|
|
42
42
|
webhook_id = f"msg_{uuid.uuid4().hex}"
|
|
43
43
|
timestamp = int(time.time())
|
|
44
44
|
return {
|
|
45
45
|
"webhook-id": webhook_id,
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"X-Webhook-Timestamp": str(timestamp),
|
|
47
|
+
"X-Webhook-Signature-V2": sign_webhook_v2(timestamp, body, secret),
|
|
48
|
+
# "webhook-timestamp": str(timestamp),
|
|
49
|
+
# "webhook-signature": sign_standard_webhook(webhook_id, timestamp, body, secret),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def sign_webhook_v2(timestamp: int | str, body: str | bytes, secret: str) -> str:
|
|
54
|
+
"""Return the Hermes ``X-Webhook-Signature-V2`` value.
|
|
55
|
+
|
|
56
|
+
Hex HMAC-SHA256 of ``"<timestamp>.<raw body>"``; the secret is used as-is
|
|
57
|
+
(UTF-8 bytes), with no ``whsec_`` stripping or base64 decoding.
|
|
58
|
+
"""
|
|
59
|
+
body_bytes = body.encode("utf-8") if isinstance(body, str) else body
|
|
60
|
+
to_sign = f"{timestamp}.".encode() + body_bytes
|
|
61
|
+
return hmac.new(secret.encode("utf-8"), to_sign, hashlib.sha256).hexdigest()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def build_hermes_v2_headers(body: bytes, secret: str) -> dict[str, str]:
|
|
65
|
+
"""Return ``X-Webhook-Timestamp`` / ``X-Webhook-Signature-V2`` headers (integer seconds).
|
|
66
|
+
|
|
67
|
+
Do not combine with ``webhook-*`` headers: Hermes picks the first matching scheme.
|
|
68
|
+
"""
|
|
69
|
+
timestamp = int(time.time())
|
|
70
|
+
return {
|
|
71
|
+
"X-Webhook-Timestamp": str(timestamp),
|
|
72
|
+
"X-Webhook-Signature-V2": sign_webhook_v2(timestamp, body, secret),
|
|
48
73
|
}
|
|
@@ -29,7 +29,7 @@ class Address(WithExtraFields):
|
|
|
29
29
|
annex_1: Optional[str] = Field(None, max_length=50, alias="Annex1", description="Adresszusatz 1")
|
|
30
30
|
annex_2: Optional[str] = Field(None, max_length=50, alias="Annex2", description="Adresszusatz 2")
|
|
31
31
|
annex_3: Optional[str] = Field(None, max_length=50, alias="Annex3", description="Adresszusatz 3")
|
|
32
|
-
po_box: Optional[str] = Field(None, max_length=50, alias="
|
|
32
|
+
po_box: Optional[str] = Field(None, max_length=50, alias="PoBox", description="Postfach")
|
|
33
33
|
# Validity and status fields
|
|
34
34
|
validity: Optional[Literal["G", "Z", "U"]] = Field(None, alias="Validity", description="Address validation status: G (Gültig), Z (Zweifelhaft), U (Ungültig)")
|
|
35
35
|
in_address_search: Optional[bool] = Field(None, alias="InAddressSearch", description="Whether this contact is currently in address search process")
|
|
@@ -120,6 +120,13 @@ class Address(WithExtraFields):
|
|
|
120
120
|
if not isinstance(data, dict):
|
|
121
121
|
return data
|
|
122
122
|
|
|
123
|
+
# Legacy IKAROS spelling "POBox" is still accepted on input; canonical name is "PoBox".
|
|
124
|
+
if "POBox" in data:
|
|
125
|
+
data = dict(data)
|
|
126
|
+
legacy = data.pop("POBox")
|
|
127
|
+
if "PoBox" not in data and "po_box" not in data:
|
|
128
|
+
data["PoBox"] = legacy
|
|
129
|
+
|
|
123
130
|
country = (data.get("country_code") or "").strip().upper()
|
|
124
131
|
if country == "D":
|
|
125
132
|
country = "DE"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: get-systems
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.46
|
|
4
4
|
Summary: Get Systems Prefect Blocks - Enterprise LLM and HTTP operations
|
|
5
5
|
Author: Get Systems
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -185,8 +185,9 @@ async def my_http_flow():
|
|
|
185
185
|
### Signing request bodies in `HttpBlock`
|
|
186
186
|
|
|
187
187
|
Set the optional `signing_secret` (`whsec_<base64>`) on `HttpBlock` and every
|
|
188
|
-
`request()` is signed per
|
|
189
|
-
`webhook-id`, `
|
|
188
|
+
`request()` is signed per the Hermes v2 scheme:
|
|
189
|
+
`webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2` (hex HMAC-SHA256 of
|
|
190
|
+
`<timestamp>.<body>`) headers are added and the
|
|
190
191
|
exact signed bytes are sent. Only `json=` and `content=` bodies are supported
|
|
191
192
|
(`data=`/`files=` raise `ValueError`).
|
|
192
193
|
|
|
@@ -203,8 +204,9 @@ the automation action "Call a webhook". It sends the request signed per the
|
|
|
203
204
|
|
|
204
205
|
Block fields: `url`, `method` (default `POST`), `headers`, `allow_private_urls`,
|
|
205
206
|
`verify` (as in `Webhook`) plus `secret` - the signing secret `whsec_<base64>`.
|
|
206
|
-
The block adds `webhook-id`, `
|
|
207
|
-
(
|
|
207
|
+
The block adds `webhook-id`, `X-Webhook-Timestamp` and `X-Webhook-Signature-V2`
|
|
208
|
+
(hex HMAC-SHA256 of `<timestamp>.<body>`, Hermes v2; the standard-webhooks
|
|
209
|
+
`webhook-timestamp`/`webhook-signature` headers are not sent) headers and `content-type: application/json` (unless set). The
|
|
208
210
|
exact signed bytes are sent: a string payload is sent as-is, a dict as compact
|
|
209
211
|
JSON, `None` as an empty body.
|
|
210
212
|
|
|
@@ -202,3 +202,32 @@ def test_additional_address_to_xml():
|
|
|
202
202
|
assert root.find("PostalCode").text == "12345"
|
|
203
203
|
assert root.find("City").text == "Berlin"
|
|
204
204
|
assert root.find("CountryCode").text == "DE"
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def test_po_box_parse_canonical_alias():
|
|
208
|
+
addr = Address(PoBox="Postfach 12", City="Berlin")
|
|
209
|
+
assert addr.po_box == "Postfach 12"
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def test_po_box_parse_legacy_alias():
|
|
213
|
+
addr = Address(POBox="Postfach 34", City="Berlin")
|
|
214
|
+
assert addr.po_box == "Postfach 34"
|
|
215
|
+
assert "POBox" not in addr.model_dump(by_alias=True)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def test_po_box_parse_by_name():
|
|
219
|
+
assert Address(po_box="Postfach 56").po_box == "Postfach 56"
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_po_box_dump_by_alias_uses_pobox():
|
|
223
|
+
dumped = Address(POBox="Postfach 78").model_dump(by_alias=True, exclude_none=True)
|
|
224
|
+
assert dumped["PoBox"] == "Postfach 78"
|
|
225
|
+
assert "POBox" not in dumped
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def test_po_box_to_xml_tag():
|
|
229
|
+
xml = Address(POBox="Postfach 90", City="Berlin").to_xml()
|
|
230
|
+
from xml.etree.ElementTree import tostring
|
|
231
|
+
text = tostring(xml, encoding="unicode") if not isinstance(xml, str) else xml
|
|
232
|
+
assert "<PoBox>Postfach 90</PoBox>" in text
|
|
233
|
+
assert "POBox" not in text
|
|
@@ -5,6 +5,7 @@ import pytest
|
|
|
5
5
|
from prefect.blocks.webhook import Webhook
|
|
6
6
|
|
|
7
7
|
from get_systems.http import SignedWebhook, sign_standard_webhook
|
|
8
|
+
from get_systems.http.signing import sign_webhook_v2
|
|
8
9
|
|
|
9
10
|
SECRET = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
|
|
10
11
|
|
|
@@ -36,13 +37,16 @@ def test_signature_matches_spec_example():
|
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
def _verify(request: httpx.Request) -> None:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
"""Hermes v2 scheme: hex HMAC-SHA256 of "<ts>.<body>", secret as-is."""
|
|
41
|
+
ts = request.headers["x-webhook-timestamp"]
|
|
42
|
+
assert ts.isdigit()
|
|
43
|
+
assert request.headers["webhook-id"].startswith("msg_")
|
|
44
|
+
assert request.headers["x-webhook-signature-v2"] == sign_webhook_v2(
|
|
45
|
+
ts, request.content, SECRET
|
|
44
46
|
)
|
|
45
|
-
|
|
47
|
+
# standard-webhooks headers are intentionally not sent (Hermes picks first scheme)
|
|
48
|
+
assert "webhook-timestamp" not in request.headers
|
|
49
|
+
assert "webhook-signature" not in request.headers
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
async def test_call_str_payload_sends_exact_body_and_headers():
|
|
@@ -55,8 +59,7 @@ async def test_call_str_payload_sends_exact_body_and_headers():
|
|
|
55
59
|
assert req.headers["x-custom"] == "1"
|
|
56
60
|
assert req.headers["content-type"] == "application/json"
|
|
57
61
|
assert req.headers["webhook-id"].startswith("msg_")
|
|
58
|
-
assert req.headers["webhook-timestamp"].isdigit()
|
|
59
|
-
assert req.headers["webhook-signature"].startswith("v1,")
|
|
62
|
+
assert req.headers["x-webhook-timestamp"].isdigit()
|
|
60
63
|
_verify(req)
|
|
61
64
|
|
|
62
65
|
|
|
@@ -157,3 +160,20 @@ async def test_http_block_without_secret_adds_no_signature():
|
|
|
157
160
|
from get_systems.http import HttpBlock
|
|
158
161
|
|
|
159
162
|
assert HttpBlock(url="https://example.com").signing_secret is None
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def test_hermes_v2_signature_and_headers():
|
|
166
|
+
import hashlib
|
|
167
|
+
import hmac
|
|
168
|
+
|
|
169
|
+
from get_systems.http.signing import build_hermes_v2_headers, sign_webhook_v2
|
|
170
|
+
|
|
171
|
+
expected = hmac.new(b"route-secret", b"1614265330.{}", hashlib.sha256).hexdigest()
|
|
172
|
+
assert sign_webhook_v2(1614265330, b"{}", "route-secret") == expected
|
|
173
|
+
|
|
174
|
+
headers = build_hermes_v2_headers(b'{"a":1}', "route-secret")
|
|
175
|
+
assert set(headers) == {"X-Webhook-Timestamp", "X-Webhook-Signature-V2"}
|
|
176
|
+
assert headers["X-Webhook-Timestamp"].isdigit()
|
|
177
|
+
assert headers["X-Webhook-Signature-V2"] == sign_webhook_v2(
|
|
178
|
+
headers["X-Webhook-Timestamp"], b'{"a":1}', "route-secret"
|
|
179
|
+
)
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|