Skip to content

Commit f1c7511

Browse files
committed
Read cap_reached on a paid answer past its overage cap
Re-pins the spec to 2026.11.17. A key on a paid plan past its organization's overage cap is now answered with Unlimited's fields and cap_reached true, never a 429, and every other answer to a paid key carries cap_reached false. The address, AS and domain results expose it beside trial_expired, and one that is not a boolean is a retried server_error. The README says so, and that a 429 without Retry-After now comes from something in front of the API, never the API itself.
1 parent 93092e2 commit f1c7511

17 files changed

Lines changed: 500 additions & 104 deletions

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ result = client.lookup("146.70.116.130", timeout=2)
199199

200200
**Changed in 2.2.0:** a timeout of 0 or less, NaN or a string used to be accepted, and failed every call.
201201

202-
Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit carries `Retry-After`, and retrying after it works: Unlimited's per-minute limit is one. A spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, but not a spent quota, and nothing else you sent either.
202+
Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit carries `Retry-After`, and retrying after it works: Unlimited's per-minute limit is one. One without it is `quota_exceeded`. The library retries rate limits for you, but not `quota_exceeded`, and nothing else you sent either. The API itself always sends `Retry-After` with a 429, so that one comes from something in between, such as a proxy; a paid key past its overage cap gets `cap_reached` instead.
203203

204204
### Database downloads
205205

@@ -352,13 +352,14 @@ Each redirect URI must be https on a public host name, or http on a loopback add
352352

353353
### Fields your plan does not include
354354

355-
Unlimited leaves out the VPN, proxy, hosting and CDN flags, the detail behind every flag but Tor's and relay's, the city and region, the Whois records and the hosted domains; a free-plan key's answer carries `trial_expired`, true once its daily trial is spent. Those are `None` when your key does not include them, which means "not in your plan" rather than "checked, and no", inside `location`, `asn`, `company` and `abuse` too.
355+
Unlimited leaves out the VPN, proxy, hosting and CDN flags, the detail behind every flag but Tor's and relay's, the city and region, the Whois records and the hosted domains; a free-plan key's answer carries `trial_expired`, true once its daily trial is spent. A paid key's carries `cap_reached`, true once its organization's overage cap is reached, when the answer has Unlimited's fields and isn't billed. Those are `None` when your key does not include them, which means "not in your plan" rather than "checked, and no", inside `location`, `asn`, `company` and `abuse` too.
356356

357357
```python
358358
result.flagged("is_hosting") # False rather than None on a plan without it
359359
result.is_hosting is None # True on Unlimited: not in your plan
360360
result.location.city is None # True on Unlimited
361361
result.trial_expired is True # a free-plan key's daily trial is spent
362+
result.cap_reached is True # a paid key is past its overage cap
362363
```
363364

364365
## Other Libraries

‎spec/openapi.yaml‎

Lines changed: 164 additions & 60 deletions
Large diffs are not rendered by default.

‎src/internetdata/_generated/api/account/account_identity.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def sync_detailed(
6464
The identity behind this credential: what it is, the organization it is
6565
scoped to, and the scopes it currently holds.
6666
67-
`user` is present for an OAuth token and ABSENT for an API key, which
67+
`user` is present for an OAuth token and absent for an API key, which
6868
has an organization but no person behind it. `credential.kind` says
6969
which you are holding, so a client can branch without guessing from a
7070
missing field.
7171
7272
Narrower than what the console shows its own user on purpose: an
7373
integration needs a name to display and an organization to address, not
74-
a profile. The `scopes` array is what the credential may do RIGHT NOW,
74+
a profile. The `scopes` array is what the credential may do right now,
7575
so a client can render its own capabilities rather than discovering
7676
them from a 403.
7777
@@ -101,14 +101,14 @@ def sync(
101101
The identity behind this credential: what it is, the organization it is
102102
scoped to, and the scopes it currently holds.
103103
104-
`user` is present for an OAuth token and ABSENT for an API key, which
104+
`user` is present for an OAuth token and absent for an API key, which
105105
has an organization but no person behind it. `credential.kind` says
106106
which you are holding, so a client can branch without guessing from a
107107
missing field.
108108
109109
Narrower than what the console shows its own user on purpose: an
110110
integration needs a name to display and an organization to address, not
111-
a profile. The `scopes` array is what the credential may do RIGHT NOW,
111+
a profile. The `scopes` array is what the credential may do right now,
112112
so a client can render its own capabilities rather than discovering
113113
them from a 403.
114114
@@ -134,14 +134,14 @@ async def asyncio_detailed(
134134
The identity behind this credential: what it is, the organization it is
135135
scoped to, and the scopes it currently holds.
136136
137-
`user` is present for an OAuth token and ABSENT for an API key, which
137+
`user` is present for an OAuth token and absent for an API key, which
138138
has an organization but no person behind it. `credential.kind` says
139139
which you are holding, so a client can branch without guessing from a
140140
missing field.
141141
142142
Narrower than what the console shows its own user on purpose: an
143143
integration needs a name to display and an organization to address, not
144-
a profile. The `scopes` array is what the credential may do RIGHT NOW,
144+
a profile. The `scopes` array is what the credential may do right now,
145145
so a client can render its own capabilities rather than discovering
146146
them from a 403.
147147
@@ -169,14 +169,14 @@ async def asyncio(
169169
The identity behind this credential: what it is, the organization it is
170170
scoped to, and the scopes it currently holds.
171171
172-
`user` is present for an OAuth token and ABSENT for an API key, which
172+
`user` is present for an OAuth token and absent for an API key, which
173173
has an organization but no person behind it. `credential.kind` says
174174
which you are holding, so a client can branch without guessing from a
175175
missing field.
176176
177177
Narrower than what the console shows its own user on purpose: an
178178
integration needs a name to display and an organization to address, not
179-
a profile. The `scopes` array is what the credential may do RIGHT NOW,
179+
a profile. The `scopes` array is what the credential may do right now,
180180
so a client can render its own capabilities rather than discovering
181181
them from a 403.
182182

‎src/internetdata/_generated/api/api_keys/account_create_apikey.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def sync_detailed(
7979
8080
Creates a key and returns its secret.
8181
82-
This is the ONLY response that ever carries the secret, and only
82+
This is the only response that ever carries the secret, and only
8383
because this is the moment it comes into existence. Store it now.
8484
8585
Args:
@@ -113,7 +113,7 @@ def sync(
113113
114114
Creates a key and returns its secret.
115115
116-
This is the ONLY response that ever carries the secret, and only
116+
This is the only response that ever carries the secret, and only
117117
because this is the moment it comes into existence. Store it now.
118118
119119
Args:
@@ -142,7 +142,7 @@ async def asyncio_detailed(
142142
143143
Creates a key and returns its secret.
144144
145-
This is the ONLY response that ever carries the secret, and only
145+
This is the only response that ever carries the secret, and only
146146
because this is the moment it comes into existence. Store it now.
147147
148148
Args:
@@ -174,7 +174,7 @@ async def asyncio(
174174
175175
Creates a key and returns its secret.
176176
177-
This is the ONLY response that ever carries the secret, and only
177+
This is the only response that ever carries the secret, and only
178178
because this is the moment it comes into existence. Store it now.
179179
180180
Args:

‎src/internetdata/_generated/api/lookup/lookup_batch.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def sync_detailed(
9797
sent, in
9898
the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as
9999
the
100-
lookup it is on any plan.
100+
lookup it is on any plan. An overage cap reached part way through answers the remaining items with
101+
Unlimited's fields and `cap_reached` `true`, in `results`.
101102
102103
Args:
103104
body (BatchLookupRequest): Up to 1000 items across the three arrays, each optional.
@@ -133,7 +134,8 @@ def sync(
133134
sent, in
134135
the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as
135136
the
136-
lookup it is on any plan.
137+
lookup it is on any plan. An overage cap reached part way through answers the remaining items with
138+
Unlimited's fields and `cap_reached` `true`, in `results`.
137139
138140
Args:
139141
body (BatchLookupRequest): Up to 1000 items across the three arrays, each optional.
@@ -164,7 +166,8 @@ async def asyncio_detailed(
164166
sent, in
165167
the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as
166168
the
167-
lookup it is on any plan.
169+
lookup it is on any plan. An overage cap reached part way through answers the remaining items with
170+
Unlimited's fields and `cap_reached` `true`, in `results`.
168171
169172
Args:
170173
body (BatchLookupRequest): Up to 1000 items across the three arrays, each optional.
@@ -198,7 +201,8 @@ async def asyncio(
198201
sent, in
199202
the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as
200203
the
201-
lookup it is on any plan.
204+
lookup it is on any plan. An overage cap reached part way through answers the remaining items with
205+
Unlimited's fields and `cap_reached` `true`, in `results`.
202206
203207
Args:
204208
body (BatchLookupRequest): Up to 1000 items across the three arrays, each optional.

‎src/internetdata/_generated/models/apikey_detail.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@_attrs_define
1717
class ApikeyDetail:
18-
"""Key METADATA. Never the key itself.
18+
"""Key metadata. Never the key itself.
1919
2020
Attributes:
2121
id (UUID):
@@ -25,7 +25,7 @@ class ApikeyDetail:
2525
expires (datetime.datetime | None | Unset):
2626
last_used_at (datetime.datetime | None | Unset):
2727
revoked_at (datetime.datetime | None | Unset):
28-
allowed_cidrs (list[str] | Unset): Source-IP allowlist. EMPTY MEANS UNRESTRICTED, not deny-all.
28+
allowed_cidrs (list[str] | Unset): Source-IP allowlist. Empty means unrestricted, not deny-all.
2929
allowed_scopes (list[str] | Unset):
3030
retrievable (bool | Unset): Whether this key's secret can still be read back. False permanently for a key issued
3131
before secrets were stored recoverably.

‎src/internetdata/_generated/models/asn_lookup_response.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class AsnLookupResponse:
5454
and the 10 most popular. Its database lists up to 1,000 an AS. Paid plans and the trial.
5555
trial_expired (bool | Unset): On every answer to a key on the free plan, and on no other: `false` while the
5656
day's trial of every field lasts, `true` once the answer has Unlimited's fields.
57+
cap_reached (bool | Unset): On every answer to a key on a paid plan, and on no other: `false` while the answer
58+
has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups
59+
answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
5760
"""
5861

5962
asn: int
@@ -81,6 +84,7 @@ class AsnLookupResponse:
8184
downstreams: list[int] | Unset = UNSET
8285
hosted_domains: AsnHostedDomains | Unset = UNSET
8386
trial_expired: bool | Unset = UNSET
87+
cap_reached: bool | Unset = UNSET
8488
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
8589

8690
def to_dict(self) -> dict[str, Any]:
@@ -149,6 +153,8 @@ def to_dict(self) -> dict[str, Any]:
149153

150154
trial_expired = self.trial_expired
151155

156+
cap_reached = self.cap_reached
157+
152158
field_dict: dict[str, Any] = {}
153159
field_dict.update(self.additional_properties)
154160
field_dict.update(
@@ -199,6 +205,8 @@ def to_dict(self) -> dict[str, Any]:
199205
field_dict["hosted_domains"] = hosted_domains
200206
if trial_expired is not UNSET:
201207
field_dict["trial_expired"] = trial_expired
208+
if cap_reached is not UNSET:
209+
field_dict["cap_reached"] = cap_reached
202210

203211
return field_dict
204212

@@ -276,6 +284,8 @@ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
276284

277285
trial_expired = d.pop("trial_expired", UNSET)
278286

287+
cap_reached = d.pop("cap_reached", UNSET)
288+
279289
asn_lookup_response = cls(
280290
asn=asn,
281291
name=name,
@@ -302,6 +312,7 @@ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
302312
downstreams=downstreams,
303313
hosted_domains=hosted_domains,
304314
trial_expired=trial_expired,
315+
cap_reached=cap_reached,
305316
)
306317

307318
asn_lookup_response.additional_properties = d

‎src/internetdata/_generated/models/database.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
@_attrs_define
2323
class Database:
24-
"""One database FAMILY, with your organization's license beside it. A
24+
"""One database family, with your organization's license beside it. A
2525
license covers the family, while a download names a specific version,
2626
so the IDs passed to `download` and `checksum` come from `versions`.
2727

‎src/internetdata/_generated/models/database_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DatabaseVersion:
1919
id (str): The versioned ID. Pass this to `download`, `checksum` and `metadata`. Example: vpn_ip_v1.
2020
version (int): Example: 1.
2121
summary (str):
22-
formats (list[DatabaseFormat]): The formats this version is BUILT in. Asking for another is a 400,
22+
formats (list[DatabaseFormat]): The formats this version is built in. Asking for another is a 400,
2323
not a gap - the `_provider` catalogs are keyed by provider ID, so no
2424
MMDB exists for them.
2525
sample_formats (list[DatabaseFormat] | Unset): The formats an evaluation sample is published in, if any.

‎src/internetdata/_generated/models/domain_lookup_response.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ class DomainLookupResponse:
3636
disposable (DisposableDetail | Unset):
3737
trial_expired (bool | Unset): On every answer to a key on the free plan, and on no other: `false` while the
3838
day's trial of every field lasts, `true` once the answer has Unlimited's fields.
39+
cap_reached (bool | Unset): On every answer to a key on a paid plan, and on no other: `false` while the answer
40+
has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups
41+
answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
3942
"""
4043

4144
domain: str
@@ -50,6 +53,7 @@ class DomainLookupResponse:
5053
ip_ranges: DomainIpRanges | Unset = UNSET
5154
disposable: DisposableDetail | Unset = UNSET
5255
trial_expired: bool | Unset = UNSET
56+
cap_reached: bool | Unset = UNSET
5357
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
5458

5559
def to_dict(self) -> dict[str, Any]:
@@ -83,6 +87,8 @@ def to_dict(self) -> dict[str, Any]:
8387

8488
trial_expired = self.trial_expired
8589

90+
cap_reached = self.cap_reached
91+
8692
field_dict: dict[str, Any] = {}
8793
field_dict.update(self.additional_properties)
8894
field_dict.update(
@@ -106,6 +112,8 @@ def to_dict(self) -> dict[str, Any]:
106112
field_dict["disposable"] = disposable
107113
if trial_expired is not UNSET:
108114
field_dict["trial_expired"] = trial_expired
115+
if cap_reached is not UNSET:
116+
field_dict["cap_reached"] = cap_reached
109117

110118
return field_dict
111119

@@ -155,6 +163,8 @@ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
155163

156164
trial_expired = d.pop("trial_expired", UNSET)
157165

166+
cap_reached = d.pop("cap_reached", UNSET)
167+
158168
domain_lookup_response = cls(
159169
domain=domain,
160170
is_registered=is_registered,
@@ -168,6 +178,7 @@ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
168178
ip_ranges=ip_ranges,
169179
disposable=disposable,
170180
trial_expired=trial_expired,
181+
cap_reached=cap_reached,
171182
)
172183

173184
domain_lookup_response.additional_properties = d

0 commit comments

Comments
 (0)