sirenic 0.1.0__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.
- sirenic-0.1.0/LICENSE +21 -0
- sirenic-0.1.0/MANIFEST.in +2 -0
- sirenic-0.1.0/PKG-INFO +179 -0
- sirenic-0.1.0/README.md +150 -0
- sirenic-0.1.0/pyproject.toml +48 -0
- sirenic-0.1.0/setup.cfg +4 -0
- sirenic-0.1.0/src/sirenic/__init__.py +64 -0
- sirenic-0.1.0/src/sirenic/_version.py +1 -0
- sirenic-0.1.0/src/sirenic/client.py +470 -0
- sirenic-0.1.0/src/sirenic/errors.py +278 -0
- sirenic-0.1.0/src/sirenic/py.typed +0 -0
- sirenic-0.1.0/src/sirenic/response.py +194 -0
- sirenic-0.1.0/src/sirenic.egg-info/PKG-INFO +179 -0
- sirenic-0.1.0/src/sirenic.egg-info/SOURCES.txt +15 -0
- sirenic-0.1.0/src/sirenic.egg-info/dependency_links.txt +1 -0
- sirenic-0.1.0/src/sirenic.egg-info/requires.txt +7 -0
- sirenic-0.1.0/src/sirenic.egg-info/top_level.txt +1 -0
sirenic-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sirenic (sirenic.eu)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sirenic-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sirenic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Sirenic API: French and European company data from the official registers, with per-block provenance. Pay with an API key or per call in x402.
|
|
5
|
+
Author-email: Sirenic <contact@sirenic.eu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://api.sirenic.eu/en/about?utm_source=forge&utm_campaign=sirenic
|
|
8
|
+
Project-URL: Documentation, https://api.sirenic.eu/en/api?utm_source=forge&utm_campaign=sirenic
|
|
9
|
+
Project-URL: Repository, https://github.com/sirenic-eu/sirenic-examples?utm_source=forge&utm_campaign=sirenic
|
|
10
|
+
Project-URL: Changelog, https://github.com/sirenic-eu/sirenic-examples/blob/main/sdk/python-sirenic/CHANGELOG.md
|
|
11
|
+
Keywords: sirenic,siren,kyb,company-data,france,europe,registry,x402,api-client
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.31
|
|
24
|
+
Provides-Extra: pay
|
|
25
|
+
Requires-Dist: x402[evm,requests]<3,>=2.20; extra == "pay"
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# sirenic: Python client for the Sirenic API
|
|
31
|
+
|
|
32
|
+
Company data from the official French and European registers (INSEE Sirene, INPI RNE and the national
|
|
33
|
+
registers of European countries), for scripts, back offices and agents. Every paid JSON response carries its
|
|
34
|
+
per-block provenance: which register each block came from, its licence, its version, its `as_of` date and a
|
|
35
|
+
state from a closed list.
|
|
36
|
+
|
|
37
|
+
- One class, `sirenic.Client`, and one dependency, `requests`.
|
|
38
|
+
- Paid routes are paid with an API key (prepaid credits) or per call in x402 (USDC or EURC on Base) with the
|
|
39
|
+
optional `[pay]` extra and a hard price cap. With neither, a paid route raises `PaymentRequired` carrying
|
|
40
|
+
the quote: a free dry run.
|
|
41
|
+
- Typed errors, read from the responses the service serves.
|
|
42
|
+
- Nothing stored, no key embedded; your key is sent to `base_url` only (default `https://api.sirenic.eu`, https
|
|
43
|
+
required except on `localhost`): `get()` takes a path, never a URL, and a redirect to another host is not
|
|
44
|
+
followed.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install sirenic # API key, or free routes only
|
|
50
|
+
pip install "sirenic[pay]" # per-call x402 payment with your own wallet
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Python 3.10 or later.
|
|
54
|
+
|
|
55
|
+
## API key
|
|
56
|
+
|
|
57
|
+
Create an account and a key on the
|
|
58
|
+
[account page](https://api.sirenic.eu/compte?utm_source=forge&utm_campaign=sirenic), then:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export SIRENIC_API_KEY=srn_live_...
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import sirenic
|
|
66
|
+
|
|
67
|
+
client = sirenic.Client() # reads SIRENIC_API_KEY; or sirenic.Client(api_key="srn_live_...")
|
|
68
|
+
profil = client.entreprise("552032534")
|
|
69
|
+
print(profil["denomination"], profil.credits_charged)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each call is paid from your prepaid balance at the price of its route. To cap a single call, pass
|
|
73
|
+
`max_credits` (for example `sirenic.Client(max_credits=0.5)`): the client first asks the free quote of the
|
|
74
|
+
same request, one more request without the key, and above the cap raises `CreditCapExceeded` without making
|
|
75
|
+
the paid call. The quote request is sent without the key, so it counts against the service's per-IP rate limit
|
|
76
|
+
for calls without a key (120 requests per minute): heavy use behind one IP address can get a 429
|
|
77
|
+
(`RateLimited`) before the paid call, which is then not made; for heavy traffic or a shared IP address, leave
|
|
78
|
+
`max_credits` unset.
|
|
79
|
+
|
|
80
|
+
## Example
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import sirenic
|
|
84
|
+
|
|
85
|
+
client = sirenic.Client()
|
|
86
|
+
|
|
87
|
+
# Free: company name to SIREN
|
|
88
|
+
for s in client.suggestions("danone")["suggestions"]:
|
|
89
|
+
print(s["siren"], s["denomination"])
|
|
90
|
+
|
|
91
|
+
# Paid: the identity plus two blocks, then the envelope of each block
|
|
92
|
+
dossier = client.dossier("552032534", blocs=["finances", "pi"])
|
|
93
|
+
for p in dossier.provenance:
|
|
94
|
+
print(p.bloc, p.source_code, p.as_of, p.precision_as_of, p.etat)
|
|
95
|
+
for liste in dossier.listes_bornees:
|
|
96
|
+
print(liste.path, liste.name, liste.nombre_total, liste.tronque)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Methods
|
|
100
|
+
|
|
101
|
+
| Method | Route |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `suggestions(q)` | `GET /v1/suggestions` (free) |
|
|
104
|
+
| `entreprise(siren)` | `GET /v1/entreprise/{siren}` |
|
|
105
|
+
| `dossier(siren, blocs)` | `GET /v1/entreprise/{siren}/dossier` |
|
|
106
|
+
| `kyb(siren)` | `GET /v1/kyb/{siren}` |
|
|
107
|
+
| `facturation_dossier(siren, iban=None)` | `GET /v1/facturation/dossier` |
|
|
108
|
+
| `get(chemin, params=None)` | any other path under `/v1/` or `/preview/` |
|
|
109
|
+
|
|
110
|
+
Each returns a `sirenic.Response`: `data` (the parsed JSON), `response["field"]`, `provenance` (a list of
|
|
111
|
+
`sirenic.Provenance`), `bloc(name)`, `listes_bornees`, `credits_charged`, `credits_remaining` and
|
|
112
|
+
`request_id`.
|
|
113
|
+
|
|
114
|
+
## Reading the envelope
|
|
115
|
+
|
|
116
|
+
`Provenance` keeps the served field names: `bloc`, `source_code`, `registre`, `mode`, `licence`, `version`,
|
|
117
|
+
`as_of` (the snapshot date) and `precision_as_of` (what that date means: official publication, Sirenic
|
|
118
|
+
ingestion or live consultation), `age_jours`, `etat` (`servi`, `absence_mesuree`, `absence_non_conclusive`,
|
|
119
|
+
`partiel`, `perime`, `indisponible`, `sans_objet`), `motif`, `couverture`, `confiance` and
|
|
120
|
+
`empreinte_sha256`. A bounded list states its total and its cut in `listes_bornees`: `nombre_total`, `tronque`
|
|
121
|
+
and `total_borne_basse`. Read the states before the numbers: an `absence_non_conclusive` block does not mean
|
|
122
|
+
"nothing to report". The closed lists and the reading rules are served for free at
|
|
123
|
+
[`GET /v1/lecture`](https://api.sirenic.eu/v1/lecture), the register codes at
|
|
124
|
+
[`GET /v1/provenance/registres`](https://api.sirenic.eu/v1/provenance/registres).
|
|
125
|
+
|
|
126
|
+
## Paying per call with x402
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import os
|
|
130
|
+
import sirenic
|
|
131
|
+
|
|
132
|
+
client = sirenic.Client(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
|
|
133
|
+
kyb = client.kyb("552032534")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The official [`x402`](https://pypi.org/project/x402/) package (2.20 or later) signs an EIP-3009 authorization
|
|
137
|
+
locally: your wallet key never leaves the process. The client pays on Base, in USDC (the first option of every
|
|
138
|
+
Sirenic quote) or in EURC when a quote offers only EURC. A quote above `max_price_usd` raises `PriceCapExceeded`
|
|
139
|
+
and nothing is signed; the cap is compared with the quoted amount, the same figure in USDC and EURC. A quote
|
|
140
|
+
with no option in these two assets raises `UnsupportedAsset`, which names the offered ones.
|
|
141
|
+
|
|
142
|
+
## Errors
|
|
143
|
+
|
|
144
|
+
| Exception | When |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `PaymentRequired` | 402 with an x402 quote: `price`, `accepts` (`asset`, `asset_name`, `network`, `pay_to`, `amount`), `quote` |
|
|
147
|
+
| `PriceCapExceeded` | x402 rail, quote above `max_price_usd`; a subclass of `PaymentRequired` |
|
|
148
|
+
| `CreditCapExceeded` | API key rail, price above `max_credits` (`credits`, `max_credits`): the call was not made; a subclass of `PriceCapExceeded` |
|
|
149
|
+
| `UnsupportedAsset` | x402 rail, no option of the quote in USDC or EURC on Base (`assets` names the offered ones); a subclass of `PaymentRequired` |
|
|
150
|
+
| `PaymentFailed` | x402 rail, the signed payment was not accepted |
|
|
151
|
+
| `InsufficientCredits` | 402 `credits_insuffisants` on the key rail: `solde`, `prix`, `recharge_url` |
|
|
152
|
+
| `AccountRequired` | 401 `compte_requis`: a route reserved to identified accounts (filed deeds) |
|
|
153
|
+
| `AuthenticationError` | 401 or 403: unknown, expired or revoked key, suspended or closed account |
|
|
154
|
+
| `InvalidRequest` | 400: a missing or malformed parameter (`champ`) |
|
|
155
|
+
| `NotFound` | 404 |
|
|
156
|
+
| `RateLimited` | 429: `retry_after` in seconds |
|
|
157
|
+
| `UpstreamUnavailable` | 503 `amont_indisponible`: the official source did not answer, retry later |
|
|
158
|
+
| `ServiceUnavailable` | any other 503, `code` from the closed list `motif_panne` of `GET /v1/lecture` |
|
|
159
|
+
| `NetworkError` | connection error or timeout |
|
|
160
|
+
|
|
161
|
+
All derive from `sirenic.SirenicError` (`status`, `code`, `message`, `body`, `headers`). A response with a
|
|
162
|
+
status of 400 or above is not charged.
|
|
163
|
+
|
|
164
|
+
## Prices
|
|
165
|
+
|
|
166
|
+
Each route has its own price, the same with an API key (1 credit = 1 EUR) and in x402 (USDC, or the same
|
|
167
|
+
figure in EURC). See the [price list](https://api.sirenic.eu/en/offres?utm_source=forge&utm_campaign=sirenic)
|
|
168
|
+
and the [API reference](https://api.sirenic.eu/en/api?utm_source=forge&utm_campaign=sirenic), one page per
|
|
169
|
+
route. `suggestions` is free.
|
|
170
|
+
|
|
171
|
+
## Links
|
|
172
|
+
|
|
173
|
+
- [Use cases](https://api.sirenic.eu/en/use-cases?utm_source=forge&utm_campaign=sirenic)
|
|
174
|
+
- [LangChain and CrewAI tools built on this client: `sirenic-agents`](https://pypi.org/project/sirenic-agents/)
|
|
175
|
+
- [Source and tests](https://github.com/sirenic-eu/sirenic-examples/tree/main/sdk/python-sirenic)
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
sirenic-0.1.0/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# sirenic: Python client for the Sirenic API
|
|
2
|
+
|
|
3
|
+
Company data from the official French and European registers (INSEE Sirene, INPI RNE and the national
|
|
4
|
+
registers of European countries), for scripts, back offices and agents. Every paid JSON response carries its
|
|
5
|
+
per-block provenance: which register each block came from, its licence, its version, its `as_of` date and a
|
|
6
|
+
state from a closed list.
|
|
7
|
+
|
|
8
|
+
- One class, `sirenic.Client`, and one dependency, `requests`.
|
|
9
|
+
- Paid routes are paid with an API key (prepaid credits) or per call in x402 (USDC or EURC on Base) with the
|
|
10
|
+
optional `[pay]` extra and a hard price cap. With neither, a paid route raises `PaymentRequired` carrying
|
|
11
|
+
the quote: a free dry run.
|
|
12
|
+
- Typed errors, read from the responses the service serves.
|
|
13
|
+
- Nothing stored, no key embedded; your key is sent to `base_url` only (default `https://api.sirenic.eu`, https
|
|
14
|
+
required except on `localhost`): `get()` takes a path, never a URL, and a redirect to another host is not
|
|
15
|
+
followed.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install sirenic # API key, or free routes only
|
|
21
|
+
pip install "sirenic[pay]" # per-call x402 payment with your own wallet
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Python 3.10 or later.
|
|
25
|
+
|
|
26
|
+
## API key
|
|
27
|
+
|
|
28
|
+
Create an account and a key on the
|
|
29
|
+
[account page](https://api.sirenic.eu/compte?utm_source=forge&utm_campaign=sirenic), then:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export SIRENIC_API_KEY=srn_live_...
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import sirenic
|
|
37
|
+
|
|
38
|
+
client = sirenic.Client() # reads SIRENIC_API_KEY; or sirenic.Client(api_key="srn_live_...")
|
|
39
|
+
profil = client.entreprise("552032534")
|
|
40
|
+
print(profil["denomination"], profil.credits_charged)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each call is paid from your prepaid balance at the price of its route. To cap a single call, pass
|
|
44
|
+
`max_credits` (for example `sirenic.Client(max_credits=0.5)`): the client first asks the free quote of the
|
|
45
|
+
same request, one more request without the key, and above the cap raises `CreditCapExceeded` without making
|
|
46
|
+
the paid call. The quote request is sent without the key, so it counts against the service's per-IP rate limit
|
|
47
|
+
for calls without a key (120 requests per minute): heavy use behind one IP address can get a 429
|
|
48
|
+
(`RateLimited`) before the paid call, which is then not made; for heavy traffic or a shared IP address, leave
|
|
49
|
+
`max_credits` unset.
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import sirenic
|
|
55
|
+
|
|
56
|
+
client = sirenic.Client()
|
|
57
|
+
|
|
58
|
+
# Free: company name to SIREN
|
|
59
|
+
for s in client.suggestions("danone")["suggestions"]:
|
|
60
|
+
print(s["siren"], s["denomination"])
|
|
61
|
+
|
|
62
|
+
# Paid: the identity plus two blocks, then the envelope of each block
|
|
63
|
+
dossier = client.dossier("552032534", blocs=["finances", "pi"])
|
|
64
|
+
for p in dossier.provenance:
|
|
65
|
+
print(p.bloc, p.source_code, p.as_of, p.precision_as_of, p.etat)
|
|
66
|
+
for liste in dossier.listes_bornees:
|
|
67
|
+
print(liste.path, liste.name, liste.nombre_total, liste.tronque)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Methods
|
|
71
|
+
|
|
72
|
+
| Method | Route |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `suggestions(q)` | `GET /v1/suggestions` (free) |
|
|
75
|
+
| `entreprise(siren)` | `GET /v1/entreprise/{siren}` |
|
|
76
|
+
| `dossier(siren, blocs)` | `GET /v1/entreprise/{siren}/dossier` |
|
|
77
|
+
| `kyb(siren)` | `GET /v1/kyb/{siren}` |
|
|
78
|
+
| `facturation_dossier(siren, iban=None)` | `GET /v1/facturation/dossier` |
|
|
79
|
+
| `get(chemin, params=None)` | any other path under `/v1/` or `/preview/` |
|
|
80
|
+
|
|
81
|
+
Each returns a `sirenic.Response`: `data` (the parsed JSON), `response["field"]`, `provenance` (a list of
|
|
82
|
+
`sirenic.Provenance`), `bloc(name)`, `listes_bornees`, `credits_charged`, `credits_remaining` and
|
|
83
|
+
`request_id`.
|
|
84
|
+
|
|
85
|
+
## Reading the envelope
|
|
86
|
+
|
|
87
|
+
`Provenance` keeps the served field names: `bloc`, `source_code`, `registre`, `mode`, `licence`, `version`,
|
|
88
|
+
`as_of` (the snapshot date) and `precision_as_of` (what that date means: official publication, Sirenic
|
|
89
|
+
ingestion or live consultation), `age_jours`, `etat` (`servi`, `absence_mesuree`, `absence_non_conclusive`,
|
|
90
|
+
`partiel`, `perime`, `indisponible`, `sans_objet`), `motif`, `couverture`, `confiance` and
|
|
91
|
+
`empreinte_sha256`. A bounded list states its total and its cut in `listes_bornees`: `nombre_total`, `tronque`
|
|
92
|
+
and `total_borne_basse`. Read the states before the numbers: an `absence_non_conclusive` block does not mean
|
|
93
|
+
"nothing to report". The closed lists and the reading rules are served for free at
|
|
94
|
+
[`GET /v1/lecture`](https://api.sirenic.eu/v1/lecture), the register codes at
|
|
95
|
+
[`GET /v1/provenance/registres`](https://api.sirenic.eu/v1/provenance/registres).
|
|
96
|
+
|
|
97
|
+
## Paying per call with x402
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import os
|
|
101
|
+
import sirenic
|
|
102
|
+
|
|
103
|
+
client = sirenic.Client(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
|
|
104
|
+
kyb = client.kyb("552032534")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The official [`x402`](https://pypi.org/project/x402/) package (2.20 or later) signs an EIP-3009 authorization
|
|
108
|
+
locally: your wallet key never leaves the process. The client pays on Base, in USDC (the first option of every
|
|
109
|
+
Sirenic quote) or in EURC when a quote offers only EURC. A quote above `max_price_usd` raises `PriceCapExceeded`
|
|
110
|
+
and nothing is signed; the cap is compared with the quoted amount, the same figure in USDC and EURC. A quote
|
|
111
|
+
with no option in these two assets raises `UnsupportedAsset`, which names the offered ones.
|
|
112
|
+
|
|
113
|
+
## Errors
|
|
114
|
+
|
|
115
|
+
| Exception | When |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `PaymentRequired` | 402 with an x402 quote: `price`, `accepts` (`asset`, `asset_name`, `network`, `pay_to`, `amount`), `quote` |
|
|
118
|
+
| `PriceCapExceeded` | x402 rail, quote above `max_price_usd`; a subclass of `PaymentRequired` |
|
|
119
|
+
| `CreditCapExceeded` | API key rail, price above `max_credits` (`credits`, `max_credits`): the call was not made; a subclass of `PriceCapExceeded` |
|
|
120
|
+
| `UnsupportedAsset` | x402 rail, no option of the quote in USDC or EURC on Base (`assets` names the offered ones); a subclass of `PaymentRequired` |
|
|
121
|
+
| `PaymentFailed` | x402 rail, the signed payment was not accepted |
|
|
122
|
+
| `InsufficientCredits` | 402 `credits_insuffisants` on the key rail: `solde`, `prix`, `recharge_url` |
|
|
123
|
+
| `AccountRequired` | 401 `compte_requis`: a route reserved to identified accounts (filed deeds) |
|
|
124
|
+
| `AuthenticationError` | 401 or 403: unknown, expired or revoked key, suspended or closed account |
|
|
125
|
+
| `InvalidRequest` | 400: a missing or malformed parameter (`champ`) |
|
|
126
|
+
| `NotFound` | 404 |
|
|
127
|
+
| `RateLimited` | 429: `retry_after` in seconds |
|
|
128
|
+
| `UpstreamUnavailable` | 503 `amont_indisponible`: the official source did not answer, retry later |
|
|
129
|
+
| `ServiceUnavailable` | any other 503, `code` from the closed list `motif_panne` of `GET /v1/lecture` |
|
|
130
|
+
| `NetworkError` | connection error or timeout |
|
|
131
|
+
|
|
132
|
+
All derive from `sirenic.SirenicError` (`status`, `code`, `message`, `body`, `headers`). A response with a
|
|
133
|
+
status of 400 or above is not charged.
|
|
134
|
+
|
|
135
|
+
## Prices
|
|
136
|
+
|
|
137
|
+
Each route has its own price, the same with an API key (1 credit = 1 EUR) and in x402 (USDC, or the same
|
|
138
|
+
figure in EURC). See the [price list](https://api.sirenic.eu/en/offres?utm_source=forge&utm_campaign=sirenic)
|
|
139
|
+
and the [API reference](https://api.sirenic.eu/en/api?utm_source=forge&utm_campaign=sirenic), one page per
|
|
140
|
+
route. `suggestions` is free.
|
|
141
|
+
|
|
142
|
+
## Links
|
|
143
|
+
|
|
144
|
+
- [Use cases](https://api.sirenic.eu/en/use-cases?utm_source=forge&utm_campaign=sirenic)
|
|
145
|
+
- [LangChain and CrewAI tools built on this client: `sirenic-agents`](https://pypi.org/project/sirenic-agents/)
|
|
146
|
+
- [Source and tests](https://github.com/sirenic-eu/sirenic-examples/tree/main/sdk/python-sirenic)
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sirenic"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the Sirenic API: French and European company data from the official registers, with per-block provenance. Pay with an API key or per call in x402."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [{ name = "Sirenic", email = "contact@sirenic.eu" }]
|
|
14
|
+
keywords = ["sirenic", "siren", "kyb", "company-data", "france", "europe", "registry", "x402", "api-client"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Office/Business :: Financial",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"requests>=2.31",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
# Per-call x402 payment with your own wallet (official x402 Foundation package). 2.20 is the first
|
|
31
|
+
# release whose handle_402_response takes the request URL, which the client passes.
|
|
32
|
+
pay = ["x402[requests,evm]>=2.20,<3"]
|
|
33
|
+
test = ["pytest>=8"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://api.sirenic.eu/en/about?utm_source=forge&utm_campaign=sirenic"
|
|
37
|
+
Documentation = "https://api.sirenic.eu/en/api?utm_source=forge&utm_campaign=sirenic"
|
|
38
|
+
Repository = "https://github.com/sirenic-eu/sirenic-examples?utm_source=forge&utm_campaign=sirenic"
|
|
39
|
+
Changelog = "https://github.com/sirenic-eu/sirenic-examples/blob/main/sdk/python-sirenic/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
sirenic = ["py.typed"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
sirenic-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Python client of the Sirenic API: French and European company data from the official registers.
|
|
2
|
+
|
|
3
|
+
import sirenic
|
|
4
|
+
|
|
5
|
+
client = sirenic.Client() # reads SIRENIC_API_KEY
|
|
6
|
+
profil = client.entreprise("552032534")
|
|
7
|
+
for p in profil.provenance:
|
|
8
|
+
print(p.bloc, p.source_code, p.as_of, p.etat)
|
|
9
|
+
|
|
10
|
+
Paid routes are paid with an API key (prepaid credits) or per call in x402
|
|
11
|
+
(``pip install "sirenic[pay]"``, ``Client(wallet_key=..., max_price_usd=...)``).
|
|
12
|
+
Without either, a paid route raises :class:`PaymentRequired` with the quote.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from ._version import __version__
|
|
16
|
+
from .client import DEFAULT_BASE_URL, DEFAULT_TIMEOUT, ENV_API_KEY, USER_AGENT, Client
|
|
17
|
+
from .errors import (
|
|
18
|
+
AccountRequired,
|
|
19
|
+
AuthenticationError,
|
|
20
|
+
CreditCapExceeded,
|
|
21
|
+
InsufficientCredits,
|
|
22
|
+
InvalidRequest,
|
|
23
|
+
NetworkError,
|
|
24
|
+
NotFound,
|
|
25
|
+
PaymentFailed,
|
|
26
|
+
PaymentOption,
|
|
27
|
+
PaymentRequired,
|
|
28
|
+
PriceCapExceeded,
|
|
29
|
+
RateLimited,
|
|
30
|
+
ServiceUnavailable,
|
|
31
|
+
SirenicError,
|
|
32
|
+
UnsupportedAsset,
|
|
33
|
+
UpstreamUnavailable,
|
|
34
|
+
)
|
|
35
|
+
from .response import Couverture, ListeBornee, Provenance, Response
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"__version__",
|
|
39
|
+
"Client",
|
|
40
|
+
"DEFAULT_BASE_URL",
|
|
41
|
+
"DEFAULT_TIMEOUT",
|
|
42
|
+
"ENV_API_KEY",
|
|
43
|
+
"USER_AGENT",
|
|
44
|
+
"Response",
|
|
45
|
+
"Provenance",
|
|
46
|
+
"Couverture",
|
|
47
|
+
"ListeBornee",
|
|
48
|
+
"PaymentOption",
|
|
49
|
+
"SirenicError",
|
|
50
|
+
"NetworkError",
|
|
51
|
+
"InvalidRequest",
|
|
52
|
+
"AuthenticationError",
|
|
53
|
+
"AccountRequired",
|
|
54
|
+
"PaymentRequired",
|
|
55
|
+
"PriceCapExceeded",
|
|
56
|
+
"CreditCapExceeded",
|
|
57
|
+
"UnsupportedAsset",
|
|
58
|
+
"PaymentFailed",
|
|
59
|
+
"InsufficientCredits",
|
|
60
|
+
"NotFound",
|
|
61
|
+
"RateLimited",
|
|
62
|
+
"ServiceUnavailable",
|
|
63
|
+
"UpstreamUnavailable",
|
|
64
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|