internetdata 2.2.0__tar.gz → 2.4.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.
- {internetdata-2.2.0 → internetdata-2.4.0}/PKG-INFO +27 -3
- {internetdata-2.2.0 → internetdata-2.4.0}/README.md +26 -2
- {internetdata-2.2.0 → internetdata-2.4.0}/scripts/v2_subset.py +18 -9
- internetdata-2.4.0/spec/openapi.yaml +1667 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/__init__.py +21 -4
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_core.py +95 -1
- internetdata-2.4.0/src/internetdata/_generated/api/account/account_identity.py +195 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/__init__.py +1 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/account_create_apikey.py +196 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/account_list_apikeys.py +175 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/account_reveal_apikey.py +212 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/account_revoke_apikey.py +187 -0
- internetdata-2.4.0/src/internetdata/_generated/api/api_keys/account_rotate_apikey.py +184 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/__init__.py +1 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/oauth_authorize.py +198 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/oauth_device_authorization.py +194 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/oauth_metadata.py +156 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/oauth_revoke.py +187 -0
- internetdata-2.4.0/src/internetdata/_generated/api/authorization/oauth_token.py +222 -0
- internetdata-2.4.0/src/internetdata/_generated/api/database_v_2/__init__.py +1 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/database_v_2/list_databases.py +4 -4
- internetdata-2.4.0/src/internetdata/_generated/api/organization/__init__.py +1 -0
- internetdata-2.4.0/src/internetdata/_generated/api/organization/account_org.py +163 -0
- internetdata-2.4.0/src/internetdata/_generated/api/organization/account_org_members.py +154 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/__init__.py +42 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_create_apikey_request.py +75 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_created_apikey.py +120 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_org.py +104 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_org_ref.py +62 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_org_wrap.py +75 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_rc.py +61 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_revealed_apikey.py +69 -0
- internetdata-2.4.0/src/internetdata/_generated/models/account_user.py +82 -0
- internetdata-2.4.0/src/internetdata/_generated/models/apikey_detail.py +212 -0
- internetdata-2.4.0/src/internetdata/_generated/models/apikey_list.py +83 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database.py +10 -10
- internetdata-2.4.0/src/internetdata/_generated/models/device_authorization.py +104 -0
- internetdata-2.4.0/src/internetdata/_generated/models/device_authorization_request.py +81 -0
- internetdata-2.4.0/src/internetdata/_generated/models/identity.py +93 -0
- internetdata-2.4.0/src/internetdata/_generated/models/oauth_authorize_code_challenge_method.py +8 -0
- internetdata-2.4.0/src/internetdata/_generated/models/oauth_authorize_response_type.py +8 -0
- internetdata-2.4.0/src/internetdata/_generated/models/oauth_error.py +72 -0
- internetdata-2.4.0/src/internetdata/_generated/models/oauth_metadata.py +184 -0
- internetdata-2.4.0/src/internetdata/_generated/models/oauth_revoke_response_200.py +45 -0
- internetdata-2.4.0/src/internetdata/_generated/models/revoke_request.py +72 -0
- internetdata-2.4.0/src/internetdata/_generated/models/token_request.py +116 -0
- internetdata-2.4.0/src/internetdata/_generated/models/token_response.py +123 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/aio.py +176 -17
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/client.py +201 -17
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/errors.py +64 -2
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/models.py +143 -0
- internetdata-2.4.0/testdata/testdata.json +1298 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/tests/helpers.py +165 -37
- {internetdata-2.2.0 → internetdata-2.4.0}/tests/test_client.py +157 -14
- {internetdata-2.2.0 → internetdata-2.4.0}/tests/test_conformance.py +17 -0
- internetdata-2.4.0/tests/test_oauth.py +395 -0
- internetdata-2.2.0/spec/openapi.yaml +0 -784
- internetdata-2.2.0/testdata/testdata.json +0 -160
- {internetdata-2.2.0 → internetdata-2.4.0}/.gitignore +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/LICENSE +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/pyproject.toml +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/scripts/download-spec.sh +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/scripts/generate.sh +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/scripts/publish.sh +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/__init__.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/__init__.py +0 -0
- {internetdata-2.2.0/src/internetdata/_generated/api/database_v_2 → internetdata-2.4.0/src/internetdata/_generated/api/account}/__init__.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/database_v_2/database_checksum_v2.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/database_v_2/database_metadata_v2.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/database_v_2/download_database_v2.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/api/database_v_2/list_downloads.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/client.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/errors.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_checksum_v2_response_200.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_format.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_license_type_type_1.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_license_type_type_2_type_1.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_license_type_type_3_type_1.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata_column.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata_sample.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata_sample_additional_property_item.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata_schema.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_metadata_size.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/database_version.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/db_checksums.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/download.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/download_outcome.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/error.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/list_databases_response_200.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/list_downloads_response_200.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/models/standing.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/_generated/types.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/src/internetdata/py.typed +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/tests/conftest.py +0 -0
- {internetdata-2.2.0 → internetdata-2.4.0}/tests/test_download.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: internetdata
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Official Python client library for the InternetData API. Download and verify licensed IP datasets.
|
|
5
5
|
Project-URL: Homepage, https://internetdata.io
|
|
6
6
|
Project-URL: Documentation, https://docs.internetdata.io
|
|
@@ -51,7 +51,7 @@ Requires Python 3.11 or newer. Type hints are included, and the package ships `p
|
|
|
51
51
|
|
|
52
52
|
## Usage
|
|
53
53
|
|
|
54
|
-
Every call needs an API key carrying the `db.download` scope. Create one in the console, then:
|
|
54
|
+
Every database call needs an API key carrying the `db.download` scope. Create one in the console, then:
|
|
55
55
|
|
|
56
56
|
```python
|
|
57
57
|
import os
|
|
@@ -167,18 +167,42 @@ except InternetDataError as err:
|
|
|
167
167
|
|
|
168
168
|
`kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`. `message` is the API's own result code, passed through as it was sent, so you can switch on `NOT_LICENSED` against `LICENSE_EXPIRED` without reading the status.
|
|
169
169
|
|
|
170
|
-
A request that runs past its `timeout` fails with `network`, and is retried like any other network failure. The default is 30 seconds per attempt, body included, so a retried call can take longer in total. A database transfer is exempt, so `download` and `download_bytes` are never cut off part way through a large file. Set it on the client, in seconds, or pass `None` for no bound. Anything else that is not a number greater than 0 raises `ValueError`
|
|
170
|
+
A request that runs past its `timeout` fails with `network`, and is retried like any other network failure. The default is 30 seconds per attempt, body included, so a retried call can take longer in total. A database transfer is exempt, so `download` and `download_bytes` are never cut off part way through a large file. Set it on the client, in seconds, or pass `None` for no bound. Anything else that is not a number greater than 0 raises `ValueError` where it is set:
|
|
171
171
|
|
|
172
172
|
```python
|
|
173
173
|
client = InternetData(api_key, timeout=10)
|
|
174
|
+
catalog = client.database.list(timeout=2)
|
|
174
175
|
```
|
|
175
176
|
|
|
177
|
+
From 2.3.0, `list`, `metadata`, `checksums`, `downloads` and `download_url` each take a keyword-only `timeout` in seconds, bounding each attempt at that one call in place of the client's; `None` there means the client's own rather than no bound. `download` and `download_bytes` deliberately take none and raise `TypeError` if handed one, rather than accepting it and quietly doing nothing: a transfer runs to gigabytes and minutes, so any bound that suits a JSON call would abandon a healthy download. `download_url` does take one, because minting the link is an ordinary API request - it bounds that request, not whatever you do with the link afterwards.
|
|
178
|
+
|
|
176
179
|
**Changed in 2.1.0:** the default was 10 seconds, and it bounded each read of a response rather than the whole attempt, so a response trickling in slowly could run past it for as long as the server kept sending.
|
|
177
180
|
|
|
178
181
|
**Changed in 2.2.0:** a timeout of 0 or less, NaN or a string used to be accepted, and failed every call.
|
|
179
182
|
|
|
180
183
|
Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is the API facing a traffic burst, and retrying later works; a spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, and server and network failures, but never a spent quota or anything else you sent.
|
|
181
184
|
|
|
185
|
+
### Sign in with OAuth (device flow)
|
|
186
|
+
|
|
187
|
+
A program running on someone's own machine can let them sign in with a browser and pick one of their API keys, instead of asking them to paste it:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from internetdata import InternetData
|
|
191
|
+
|
|
192
|
+
with InternetData() as signin:
|
|
193
|
+
device = signin.oauth.device_authorization(
|
|
194
|
+
"your-client-id", scope="account.read apikeys.read apikeys.reveal"
|
|
195
|
+
)
|
|
196
|
+
print(f"Open {device.verification_uri} and enter {device.user_code}")
|
|
197
|
+
tokens = signin.oauth.poll_device_token("your-client-id", device)
|
|
198
|
+
|
|
199
|
+
if tokens.apikey is None:
|
|
200
|
+
raise SystemExit("No API key was picked")
|
|
201
|
+
client = InternetData(tokens.apikey)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
A refusal raises `OauthAccessDeniedError` and a code that ran out raises `OauthExpiredTokenError`, and client IDs are issued on request from support@internetdata.io. `client.oauth.revoke("your-client-id", tokens.refresh_token)` signs the machine out.
|
|
205
|
+
|
|
182
206
|
## Other Libraries
|
|
183
207
|
|
|
184
208
|
There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/internetdata for more.
|
|
@@ -17,7 +17,7 @@ Requires Python 3.11 or newer. Type hints are included, and the package ships `p
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
Every call needs an API key carrying the `db.download` scope. Create one in the console, then:
|
|
20
|
+
Every database call needs an API key carrying the `db.download` scope. Create one in the console, then:
|
|
21
21
|
|
|
22
22
|
```python
|
|
23
23
|
import os
|
|
@@ -133,18 +133,42 @@ except InternetDataError as err:
|
|
|
133
133
|
|
|
134
134
|
`kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`. `message` is the API's own result code, passed through as it was sent, so you can switch on `NOT_LICENSED` against `LICENSE_EXPIRED` without reading the status.
|
|
135
135
|
|
|
136
|
-
A request that runs past its `timeout` fails with `network`, and is retried like any other network failure. The default is 30 seconds per attempt, body included, so a retried call can take longer in total. A database transfer is exempt, so `download` and `download_bytes` are never cut off part way through a large file. Set it on the client, in seconds, or pass `None` for no bound. Anything else that is not a number greater than 0 raises `ValueError`
|
|
136
|
+
A request that runs past its `timeout` fails with `network`, and is retried like any other network failure. The default is 30 seconds per attempt, body included, so a retried call can take longer in total. A database transfer is exempt, so `download` and `download_bytes` are never cut off part way through a large file. Set it on the client, in seconds, or pass `None` for no bound. Anything else that is not a number greater than 0 raises `ValueError` where it is set:
|
|
137
137
|
|
|
138
138
|
```python
|
|
139
139
|
client = InternetData(api_key, timeout=10)
|
|
140
|
+
catalog = client.database.list(timeout=2)
|
|
140
141
|
```
|
|
141
142
|
|
|
143
|
+
From 2.3.0, `list`, `metadata`, `checksums`, `downloads` and `download_url` each take a keyword-only `timeout` in seconds, bounding each attempt at that one call in place of the client's; `None` there means the client's own rather than no bound. `download` and `download_bytes` deliberately take none and raise `TypeError` if handed one, rather than accepting it and quietly doing nothing: a transfer runs to gigabytes and minutes, so any bound that suits a JSON call would abandon a healthy download. `download_url` does take one, because minting the link is an ordinary API request - it bounds that request, not whatever you do with the link afterwards.
|
|
144
|
+
|
|
142
145
|
**Changed in 2.1.0:** the default was 10 seconds, and it bounded each read of a response rather than the whole attempt, so a response trickling in slowly could run past it for as long as the server kept sending.
|
|
143
146
|
|
|
144
147
|
**Changed in 2.2.0:** a timeout of 0 or less, NaN or a string used to be accepted, and failed every call.
|
|
145
148
|
|
|
146
149
|
Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is the API facing a traffic burst, and retrying later works; a spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, and server and network failures, but never a spent quota or anything else you sent.
|
|
147
150
|
|
|
151
|
+
### Sign in with OAuth (device flow)
|
|
152
|
+
|
|
153
|
+
A program running on someone's own machine can let them sign in with a browser and pick one of their API keys, instead of asking them to paste it:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from internetdata import InternetData
|
|
157
|
+
|
|
158
|
+
with InternetData() as signin:
|
|
159
|
+
device = signin.oauth.device_authorization(
|
|
160
|
+
"your-client-id", scope="account.read apikeys.read apikeys.reveal"
|
|
161
|
+
)
|
|
162
|
+
print(f"Open {device.verification_uri} and enter {device.user_code}")
|
|
163
|
+
tokens = signin.oauth.poll_device_token("your-client-id", device)
|
|
164
|
+
|
|
165
|
+
if tokens.apikey is None:
|
|
166
|
+
raise SystemExit("No API key was picked")
|
|
167
|
+
client = InternetData(tokens.apikey)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
A refusal raises `OauthAccessDeniedError` and a code that ran out raises `OauthExpiredTokenError`, and client IDs are issued on request from support@internetdata.io. `client.oauth.revoke("your-client-id", tokens.refresh_token)` signs the machine out.
|
|
171
|
+
|
|
148
172
|
## Other Libraries
|
|
149
173
|
|
|
150
174
|
There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/internetdata for more.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
|
|
3
|
-
"""Narrows the pinned spec to
|
|
3
|
+
"""Narrows the pinned spec to what this client generates from, for codegen only.
|
|
4
4
|
|
|
5
5
|
python3 scripts/v2_subset.py spec/openapi.yaml /tmp/v2.yaml
|
|
6
6
|
|
|
@@ -11,6 +11,10 @@ rather than a bearer token), a different error vocabulary, and no `list`. Genera
|
|
|
11
11
|
would ship dead modules and, worse, a second credential spelling that looks usable from
|
|
12
12
|
this client and is not.
|
|
13
13
|
|
|
14
|
+
Everything else is kept: the v2 database, IAM and OAuth, as the VPNDetection SDK generates
|
|
15
|
+
them. IAM is generated and left unwrapped; the `oauth` accessor sends its own requests
|
|
16
|
+
and never calls the generated authorization endpoints.
|
|
17
|
+
|
|
14
18
|
So the narrowing happens here rather than in the pinned copy. Unreferenced components go
|
|
15
19
|
with the paths, or the generator emits models for v1 envelopes nothing can reach.
|
|
16
20
|
|
|
@@ -25,7 +29,12 @@ from typing import Any
|
|
|
25
29
|
|
|
26
30
|
from ruamel.yaml import YAML
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
KEEP_PATH_PREFIXES = (
|
|
33
|
+
"/api/v2/",
|
|
34
|
+
"/api/v1/iam/",
|
|
35
|
+
"/oauth/",
|
|
36
|
+
"/.well-known/oauth-authorization-server",
|
|
37
|
+
)
|
|
29
38
|
# v1's `?apikey=` credential. Dropped with v1 itself: leaving it in the spec would put a
|
|
30
39
|
# second, unusable auth spelling in the generated client.
|
|
31
40
|
DROP_SECURITY_SCHEMES = ("ApiKeyAuth",)
|
|
@@ -40,18 +49,18 @@ def main(source: str, destination: str) -> int:
|
|
|
40
49
|
spec: dict[str, Any] = yaml.load(handle)
|
|
41
50
|
|
|
42
51
|
paths = spec.get("paths", {})
|
|
43
|
-
dropped = [path for path in paths if not path.startswith(
|
|
52
|
+
dropped = [path for path in paths if not path.startswith(KEEP_PATH_PREFIXES)]
|
|
44
53
|
for path in dropped:
|
|
45
54
|
del paths[path]
|
|
46
|
-
if not paths:
|
|
47
|
-
raise SystemExit(f"no {
|
|
55
|
+
if not any(path.startswith(KEEP_PATH_PREFIXES[0]) for path in paths):
|
|
56
|
+
raise SystemExit(f"no {KEEP_PATH_PREFIXES[0]} paths survived, so the spec moved under us")
|
|
48
57
|
|
|
49
58
|
components = spec.get("components", {})
|
|
50
59
|
for scheme in DROP_SECURITY_SCHEMES:
|
|
51
60
|
components.get("securitySchemes", {}).pop(scheme, None)
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
spec
|
|
61
|
+
# Every kept operation names its own security, so a document-level default could only
|
|
62
|
+
# name the dropped v1 scheme, which would leave the spec invalid.
|
|
63
|
+
spec.pop("security", None)
|
|
55
64
|
|
|
56
65
|
reachable = resolve_refs(spec, components)
|
|
57
66
|
for section in REF_SECTIONS:
|
|
@@ -65,7 +74,7 @@ def main(source: str, destination: str) -> int:
|
|
|
65
74
|
|
|
66
75
|
with open(destination, "w") as handle:
|
|
67
76
|
yaml.dump(spec, handle)
|
|
68
|
-
print(f"{destination} <- {source} ({len(paths)}
|
|
77
|
+
print(f"{destination} <- {source} ({len(paths)} paths kept, dropped {len(dropped)})")
|
|
69
78
|
return 0
|
|
70
79
|
|
|
71
80
|
|