fiderail 2.3.2__tar.gz → 2.3.4__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.
- {fiderail-2.3.2 → fiderail-2.3.4}/PKG-INFO +1 -3
- {fiderail-2.3.2 → fiderail-2.3.4}/README.md +0 -1
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/client.py +12 -2
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/spec.py +1 -1
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail.egg-info/PKG-INFO +1 -3
- {fiderail-2.3.2 → fiderail-2.3.4}/pyproject.toml +1 -2
- {fiderail-2.3.2 → fiderail-2.3.4}/tests/test_fiderail_sdk.py +38 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/LICENSE +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/__init__.py +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/ledger.py +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/policy.py +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail/py.typed +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail.egg-info/SOURCES.txt +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail.egg-info/dependency_links.txt +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/fiderail.egg-info/top_level.txt +0 -0
- {fiderail-2.3.2 → fiderail-2.3.4}/setup.cfg +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fiderail
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Non-custodial AI Agent payment control plane, pre-flight firewall, anti-sybil cloud client, and concurrent SQLite edge ledger (zero dependencies).
|
|
5
5
|
Author-email: FideRail Contributors <founder@fiderail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://fiderail.com
|
|
8
8
|
Project-URL: Documentation, https://fiderail.com/docs
|
|
9
9
|
Project-URL: Repository, https://gitlab.com/fiderail/fiderail
|
|
10
|
-
Project-URL: GitHub, https://github.com/fiderail/fiderail
|
|
11
10
|
Project-URL: Issues, https://gitlab.com/fiderail/fiderail/-/issues
|
|
12
11
|
Keywords: fiderail,ai-agent,payment-control-plane,firewall,x402,anti-sybil,base,solana,arbitrum,polygon,usdc,sqlite
|
|
13
12
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -102,7 +101,6 @@ Omit `signer` to run a dry-run pre-flight check without executing a payment.
|
|
|
102
101
|
- Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
|
|
103
102
|
- REST API & Streamable HTTP MCP: [https://api.fiderail.com](https://api.fiderail.com)
|
|
104
103
|
- Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
|
|
105
|
-
- Mirror (GitHub — pending reinstatement): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
|
|
106
104
|
- Security & Contact: `security@fiderail.com` · `founder@fiderail.com`
|
|
107
105
|
|
|
108
106
|
## License
|
|
@@ -73,7 +73,6 @@ Omit `signer` to run a dry-run pre-flight check without executing a payment.
|
|
|
73
73
|
- Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
|
|
74
74
|
- REST API & Streamable HTTP MCP: [https://api.fiderail.com](https://api.fiderail.com)
|
|
75
75
|
- Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
|
|
76
|
-
- Mirror (GitHub — pending reinstatement): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
|
|
77
76
|
- Security & Contact: `security@fiderail.com` · `founder@fiderail.com`
|
|
78
77
|
|
|
79
78
|
## License
|
|
@@ -25,6 +25,7 @@ from .policy import (
|
|
|
25
25
|
)
|
|
26
26
|
from .spec import (
|
|
27
27
|
API_BASE_URL,
|
|
28
|
+
SDK_VERSION,
|
|
28
29
|
get_asset_spec,
|
|
29
30
|
get_primary_asset,
|
|
30
31
|
is_valid_address,
|
|
@@ -34,6 +35,15 @@ from .spec import (
|
|
|
34
35
|
to_usd_amount,
|
|
35
36
|
)
|
|
36
37
|
|
|
38
|
+
DEFAULT_USER_AGENT = f"FideRail-Python-SDK/{SDK_VERSION}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _with_default_user_agent(headers: Dict[str, str]) -> Dict[str, str]:
|
|
42
|
+
merged = dict(headers)
|
|
43
|
+
if not any(k.lower() == "user-agent" for k in merged):
|
|
44
|
+
merged["User-Agent"] = DEFAULT_USER_AGENT
|
|
45
|
+
return merged
|
|
46
|
+
|
|
37
47
|
|
|
38
48
|
def parse_x402_challenge(headers: Dict[str, str], body_obj: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
|
|
39
49
|
challenge = body_obj if isinstance(body_obj, dict) else None
|
|
@@ -109,7 +119,7 @@ class FideRailClient:
|
|
|
109
119
|
def _request_json(self, method: str, path: str, body: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
110
120
|
url = f"{self.api_base_url}{path}"
|
|
111
121
|
data = json.dumps(body).encode("utf-8") if body is not None else None
|
|
112
|
-
headers = {"Accept": "application/json"}
|
|
122
|
+
headers = _with_default_user_agent({"Accept": "application/json"})
|
|
113
123
|
if data is not None:
|
|
114
124
|
headers["Content-Type"] = "application/json"
|
|
115
125
|
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
|
@@ -332,7 +342,7 @@ class FideRailClient:
|
|
|
332
342
|
return {"paid": False, "blocked": True, "decision": "BLOCK", "reason": "CIRCUIT_BREAKER_OPEN"}
|
|
333
343
|
|
|
334
344
|
def _http_call(extra_headers: Optional[Dict[str, str]] = None) -> Tuple[int, Dict[str, str], str]:
|
|
335
|
-
all_headers = {**req_headers, **(extra_headers or {})}
|
|
345
|
+
all_headers = _with_default_user_agent({**req_headers, **(extra_headers or {})})
|
|
336
346
|
payload = serialize_body(body).encode("utf-8") if body is not None else None
|
|
337
347
|
req = urllib.request.Request(url, data=payload, headers=all_headers, method=method)
|
|
338
348
|
try:
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fiderail
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Non-custodial AI Agent payment control plane, pre-flight firewall, anti-sybil cloud client, and concurrent SQLite edge ledger (zero dependencies).
|
|
5
5
|
Author-email: FideRail Contributors <founder@fiderail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://fiderail.com
|
|
8
8
|
Project-URL: Documentation, https://fiderail.com/docs
|
|
9
9
|
Project-URL: Repository, https://gitlab.com/fiderail/fiderail
|
|
10
|
-
Project-URL: GitHub, https://github.com/fiderail/fiderail
|
|
11
10
|
Project-URL: Issues, https://gitlab.com/fiderail/fiderail/-/issues
|
|
12
11
|
Keywords: fiderail,ai-agent,payment-control-plane,firewall,x402,anti-sybil,base,solana,arbitrum,polygon,usdc,sqlite
|
|
13
12
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -102,7 +101,6 @@ Omit `signer` to run a dry-run pre-flight check without executing a payment.
|
|
|
102
101
|
- Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
|
|
103
102
|
- REST API & Streamable HTTP MCP: [https://api.fiderail.com](https://api.fiderail.com)
|
|
104
103
|
- Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
|
|
105
|
-
- Mirror (GitHub — pending reinstatement): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
|
|
106
104
|
- Security & Contact: `security@fiderail.com` · `founder@fiderail.com`
|
|
107
105
|
|
|
108
106
|
## License
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fiderail"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.4"
|
|
8
8
|
description = "Non-custodial AI Agent payment control plane, pre-flight firewall, anti-sybil cloud client, and concurrent SQLite edge ledger (zero dependencies)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -47,7 +47,6 @@ classifiers = [
|
|
|
47
47
|
Homepage = "https://fiderail.com"
|
|
48
48
|
Documentation = "https://fiderail.com/docs"
|
|
49
49
|
Repository = "https://gitlab.com/fiderail/fiderail"
|
|
50
|
-
GitHub = "https://github.com/fiderail/fiderail"
|
|
51
50
|
Issues = "https://gitlab.com/fiderail/fiderail/-/issues"
|
|
52
51
|
|
|
53
52
|
[tool.setuptools.packages.find]
|
|
@@ -564,6 +564,44 @@ class FideRailPythonSdkTests(unittest.TestCase):
|
|
|
564
564
|
server.shutdown()
|
|
565
565
|
server.server_close()
|
|
566
566
|
|
|
567
|
+
def test_09_custom_user_agent_header(self) -> None:
|
|
568
|
+
observed_uas = []
|
|
569
|
+
|
|
570
|
+
class UaHandler(http.server.BaseHTTPRequestHandler):
|
|
571
|
+
def log_message(self, format: str, *args) -> None: # noqa: A002
|
|
572
|
+
pass
|
|
573
|
+
|
|
574
|
+
def do_GET(self) -> None:
|
|
575
|
+
observed_uas.append((self.path, self.headers.get("User-Agent")))
|
|
576
|
+
if self.path == "/healthz":
|
|
577
|
+
self.send_response(200)
|
|
578
|
+
self.send_header("Content-Type", "application/json")
|
|
579
|
+
self.end_headers()
|
|
580
|
+
self.wfile.write(json.dumps({"status": "ok"}).encode("utf-8"))
|
|
581
|
+
return
|
|
582
|
+
self.send_response(200)
|
|
583
|
+
self.send_header("Content-Type", "application/json")
|
|
584
|
+
self.end_headers()
|
|
585
|
+
self.wfile.write(json.dumps({"ok": True}).encode("utf-8"))
|
|
586
|
+
|
|
587
|
+
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), UaHandler)
|
|
588
|
+
port = server.server_address[1]
|
|
589
|
+
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
|
590
|
+
thread.start()
|
|
591
|
+
client = FideRailClient(f"http://127.0.0.1:{port}")
|
|
592
|
+
try:
|
|
593
|
+
client.get_health()
|
|
594
|
+
client.guarded_x402_request(f"http://127.0.0.1:{port}/free", telemetry_opt_out=True)
|
|
595
|
+
expected_ua = f"FideRail-Python-SDK/{fiderail.SDK_VERSION}"
|
|
596
|
+
self.assertEqual(len(observed_uas), 2)
|
|
597
|
+
for req_path, ua in observed_uas:
|
|
598
|
+
self.assertEqual(ua, expected_ua, f"Unexpected User-Agent on {req_path}: {ua}")
|
|
599
|
+
self.assertFalse((ua or "").startswith("Python-urllib/"))
|
|
600
|
+
finally:
|
|
601
|
+
client.close()
|
|
602
|
+
server.shutdown()
|
|
603
|
+
server.server_close()
|
|
604
|
+
|
|
567
605
|
|
|
568
606
|
if __name__ == "__main__":
|
|
569
607
|
unittest.main()
|
|
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
|