atlasdata-sdk 0.1.0__py3-none-any.whl
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.
atlasdata/__init__.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""AtlasData SDK — paid crypto market-data API over x402 (USDC/Base) or L402 (Lightning).
|
|
2
|
+
|
|
3
|
+
Docs: https://atlasdata.surge.sh · catalog: https://atlasdata.shares.zrok.io/llms.txt
|
|
4
|
+
"""
|
|
5
|
+
import requests
|
|
6
|
+
|
|
7
|
+
DEFAULT_BASE = "https://atlasdata.shares.zrok.io"
|
|
8
|
+
|
|
9
|
+
class AtlasData:
|
|
10
|
+
def __init__(self, base=DEFAULT_BASE):
|
|
11
|
+
self.base = base.rstrip("/")
|
|
12
|
+
self.s = requests.Session()
|
|
13
|
+
|
|
14
|
+
# ---- free sample ----
|
|
15
|
+
def free_price(self, symbol="BTC"):
|
|
16
|
+
return self.s.get(f"{self.base}/free/price/{symbol}", timeout=15).json()
|
|
17
|
+
|
|
18
|
+
# ---- L402 (pay invoice, pass preimage) ----
|
|
19
|
+
def l402_call(self, path, pay_invoice):
|
|
20
|
+
"""One-call L402 helper. pay_invoice(bolt11)->preimage.
|
|
21
|
+
|
|
22
|
+
On 402, calls pay_invoice(invoice) to obtain the preimage,
|
|
23
|
+
then retries with the Authorization header. Works with any wallet
|
|
24
|
+
that can pay a BOLT11 and return the preimage.
|
|
25
|
+
"""
|
|
26
|
+
r = self.s.get(self.base + path, timeout=15)
|
|
27
|
+
if r.status_code != 402:
|
|
28
|
+
return r.json()
|
|
29
|
+
d = r.json()
|
|
30
|
+
preimage = pay_invoice(d["invoice"])
|
|
31
|
+
r2 = self.s.get(self.base + path,
|
|
32
|
+
headers={"Authorization": f"L402 {d['token']}:{preimage}"}, timeout=15)
|
|
33
|
+
return r2.json()
|
|
34
|
+
|
|
35
|
+
def l402_challenge(self, path):
|
|
36
|
+
"""Return the 402 challenge (invoice, price, token) without paying."""
|
|
37
|
+
r = self.s.get(self.base + path, timeout=15)
|
|
38
|
+
return r.json() if r.status_code == 402 else {"status": r.status_code, "body": r.json()}
|
|
39
|
+
|
|
40
|
+
# ---- x402 (USDC on Base) ----
|
|
41
|
+
def x402_challenge(self, path):
|
|
42
|
+
r = self.s.get(self.base + path, timeout=15)
|
|
43
|
+
return r.json() if r.status_code == 402 else {"status": r.status_code, "body": r.json()}
|
|
44
|
+
|
|
45
|
+
def x402_call(self, path, x_payment_header):
|
|
46
|
+
r = self.s.get(self.base + path, headers={"X-PAYMENT": x_payment_header}, timeout=15)
|
|
47
|
+
return r.json()
|
|
48
|
+
|
|
49
|
+
# ---- paid report store ----
|
|
50
|
+
def report(self, slug, x_payment_header=None):
|
|
51
|
+
return self.x402_call(f"/api/report/{slug}", x_payment_header) if x_payment_header else self.x402_challenge(f"/api/report/{slug}")
|
|
52
|
+
|
|
53
|
+
__all__ = ["AtlasData", "DEFAULT_BASE"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: atlasdata-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Client for the AtlasData crypto market-data API — x402 (USDC/Base) and L402 (Lightning) per-request payments, plus a free sample endpoint
|
|
5
|
+
Author: AtlasData
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://atlasdata.surge.sh
|
|
8
|
+
Project-URL: Catalog, https://atlasdata.shares.zrok.io/llms.txt
|
|
9
|
+
Keywords: x402,l402,crypto,api,bitcoin,lightning,payments,agent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: requests>=2.28
|
|
15
|
+
|
|
16
|
+
# atlasdata-sdk
|
|
17
|
+
|
|
18
|
+
Client for the AtlasData crypto market-data API.
|
|
19
|
+
|
|
20
|
+
- 20 x402 endpoints paid in USDC on Base ($0.001–$0.50)
|
|
21
|
+
- 7 L402 endpoints paid over Lightning (10–200 sats)
|
|
22
|
+
- 1 free sample endpoint, no payment
|
|
23
|
+
- Paid research reports: x402 monetization, L402 playbook, agent micropayments market, mempool fee guide
|
|
24
|
+
|
|
25
|
+
Live: https://atlasdata.surge.sh · Catalog: https://atlasdata.shares.zrok.io/llms.txt
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from atlasdata import AtlasData
|
|
29
|
+
a = AtlasData()
|
|
30
|
+
print(a.free_price("BTC")) # free
|
|
31
|
+
print(a.l402_challenge("/l402/gas")) # returns a BOLT11 invoice for 10 sats
|
|
32
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
atlasdata/__init__.py,sha256=qZCj6q7iivPDAsJqotMGeG4UppXgvAx-hBxIAVY3WPw,2169
|
|
2
|
+
atlasdata_sdk-0.1.0.dist-info/METADATA,sha256=OW0aFzGRvZnW8CmyG88mVRpfhoOuf-4-NLUaNQW18NU,1207
|
|
3
|
+
atlasdata_sdk-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
4
|
+
atlasdata_sdk-0.1.0.dist-info/top_level.txt,sha256=2BHNW3f_XARt2oxktUG3y_qk-Jh-8NGVV3SAWSIJuIU,10
|
|
5
|
+
atlasdata_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
atlasdata
|