internetdata 2.15.1__tar.gz → 2.16.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.
Files changed (166) hide show
  1. {internetdata-2.15.1 → internetdata-2.16.0}/PKG-INFO +24 -9
  2. {internetdata-2.15.1 → internetdata-2.16.0}/README.md +23 -8
  3. {internetdata-2.15.1 → internetdata-2.16.0}/scripts/generate.sh +27 -0
  4. {internetdata-2.15.1 → internetdata-2.16.0}/spec/openapi.yaml +85 -80
  5. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/__init__.py +1 -1
  6. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_core.py +22 -4
  7. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/account_create_apikey.py +8 -16
  8. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/account_list_apikeys.py +20 -12
  9. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/download_database_v2.py +16 -8
  10. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/list_downloads.py +8 -8
  11. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/organization/account_org.py +12 -16
  12. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/organization/account_org_members.py +16 -12
  13. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/asn.py +2 -2
  14. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/asn_lookup_response.py +2 -2
  15. internetdata-2.16.0/src/internetdata/_generated/models/database_format.py +19 -0
  16. internetdata-2.16.0/src/internetdata/_generated/models/database_license_type_type_1.py +20 -0
  17. internetdata-2.16.0/src/internetdata/_generated/models/database_license_type_type_2_type_1.py +20 -0
  18. internetdata-2.16.0/src/internetdata/_generated/models/database_license_type_type_3_type_1.py +20 -0
  19. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/domain_lookup_response.py +2 -2
  20. internetdata-2.16.0/src/internetdata/_generated/models/download_outcome.py +23 -0
  21. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/entitlement_plan.py +2 -2
  22. internetdata-2.16.0/src/internetdata/_generated/models/entitlement_plan_tier.py +21 -0
  23. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/lookup_response.py +2 -2
  24. internetdata-2.16.0/src/internetdata/_generated/models/standing.py +20 -0
  25. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/aio.py +7 -6
  26. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/client.py +9 -9
  27. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/middleware/core.py +1 -1
  28. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/models.py +30 -20
  29. {internetdata-2.15.1 → internetdata-2.16.0}/testdata/testdata.json +226 -1
  30. internetdata-2.16.0/tests/test_cache_life.py +80 -0
  31. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_client.py +17 -15
  32. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_conformance.py +82 -0
  33. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_lookup.py +2 -2
  34. internetdata-2.15.1/src/internetdata/_generated/models/database_format.py +0 -9
  35. internetdata-2.15.1/src/internetdata/_generated/models/database_license_type_type_1.py +0 -10
  36. internetdata-2.15.1/src/internetdata/_generated/models/database_license_type_type_2_type_1.py +0 -10
  37. internetdata-2.15.1/src/internetdata/_generated/models/database_license_type_type_3_type_1.py +0 -10
  38. internetdata-2.15.1/src/internetdata/_generated/models/download_outcome.py +0 -13
  39. internetdata-2.15.1/src/internetdata/_generated/models/entitlement_plan_tier.py +0 -11
  40. internetdata-2.15.1/src/internetdata/_generated/models/standing.py +0 -10
  41. {internetdata-2.15.1 → internetdata-2.16.0}/.gitignore +0 -0
  42. {internetdata-2.15.1 → internetdata-2.16.0}/LICENSE +0 -0
  43. {internetdata-2.15.1 → internetdata-2.16.0}/pyproject.toml +0 -0
  44. {internetdata-2.15.1 → internetdata-2.16.0}/scripts/download-spec.sh +0 -0
  45. {internetdata-2.15.1 → internetdata-2.16.0}/scripts/publish.sh +0 -0
  46. {internetdata-2.15.1 → internetdata-2.16.0}/scripts/v2_subset.py +0 -0
  47. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_bogons.py +0 -0
  48. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/__init__.py +0 -0
  49. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/__init__.py +0 -0
  50. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/account/__init__.py +0 -0
  51. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/account/account_identity.py +0 -0
  52. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/__init__.py +0 -0
  53. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/account_reveal_apikey.py +0 -0
  54. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/account_revoke_apikey.py +0 -0
  55. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/api_keys/account_rotate_apikey.py +0 -0
  56. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/__init__.py +0 -0
  57. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_authorize.py +0 -0
  58. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_device_authorization.py +0 -0
  59. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_metadata.py +0 -0
  60. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_register.py +0 -0
  61. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_revoke.py +0 -0
  62. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/authorization/oauth_token.py +0 -0
  63. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/__init__.py +0 -0
  64. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/database_checksum_v2.py +0 -0
  65. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/database_metadata_v2.py +0 -0
  66. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/database_v_2/list_databases.py +0 -0
  67. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/entitlement/__init__.py +0 -0
  68. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/entitlement/my_entitlement.py +0 -0
  69. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/__init__.py +0 -0
  70. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/lookup_asn.py +0 -0
  71. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/lookup_batch.py +0 -0
  72. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/lookup_domain.py +0 -0
  73. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/lookup_ip.py +0 -0
  74. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/lookup/lookup_my_ip.py +0 -0
  75. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/api/organization/__init__.py +0 -0
  76. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/client.py +0 -0
  77. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/errors.py +0 -0
  78. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/__init__.py +0 -0
  79. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/abuse_contact.py +0 -0
  80. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_create_apikey_request.py +0 -0
  81. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_created_apikey.py +0 -0
  82. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_org.py +0 -0
  83. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_org_ref.py +0 -0
  84. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_org_wrap.py +0 -0
  85. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_rc.py +0 -0
  86. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_revealed_apikey.py +0 -0
  87. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/account_user.py +0 -0
  88. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/apikey_detail.py +0 -0
  89. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/apikey_list.py +0 -0
  90. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/asn_hosted_domains.py +0 -0
  91. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/asn_lookup_response_whois.py +0 -0
  92. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/asn_prefix.py +0 -0
  93. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/batch_lookup_error.py +0 -0
  94. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/batch_lookup_request.py +0 -0
  95. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/batch_lookup_response.py +0 -0
  96. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/batch_lookup_response_errors.py +0 -0
  97. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/batch_lookup_response_results.py +0 -0
  98. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/bit_torrent_detail.py +0 -0
  99. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/carrier_detail.py +0 -0
  100. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/class_detail.py +0 -0
  101. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/client_registration.py +0 -0
  102. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/client_registration_request.py +0 -0
  103. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/company.py +0 -0
  104. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database.py +0 -0
  105. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_checksum_v2_response_200.py +0 -0
  106. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata.py +0 -0
  107. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_column.py +0 -0
  108. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_sample.py +0 -0
  109. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_sample_additional_property_item.py +0 -0
  110. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_sample_size.py +0 -0
  111. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_schema.py +0 -0
  112. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_metadata_size.py +0 -0
  113. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/database_version.py +0 -0
  114. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/db_checksums.py +0 -0
  115. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/device_authorization.py +0 -0
  116. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/device_authorization_request.py +0 -0
  117. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/disposable_detail.py +0 -0
  118. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/dns_address_record.py +0 -0
  119. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/dns_cname_record.py +0 -0
  120. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/dns_mx_record.py +0 -0
  121. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/dns_ns_record.py +0 -0
  122. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/dns_resolver_detail.py +0 -0
  123. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/domain_dns.py +0 -0
  124. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/domain_ip_range.py +0 -0
  125. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/domain_ip_ranges.py +0 -0
  126. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/download.py +0 -0
  127. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/entitlement.py +0 -0
  128. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/entitlement_apikey.py +0 -0
  129. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/entitlement_error.py +0 -0
  130. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/entitlement_usage.py +0 -0
  131. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/error.py +0 -0
  132. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/hosted_domains.py +0 -0
  133. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/identity.py +0 -0
  134. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/list_databases_response_200.py +0 -0
  135. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/list_downloads_response_200.py +0 -0
  136. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/location.py +0 -0
  137. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/lookup_error.py +0 -0
  138. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/oauth_authorize_code_challenge_method.py +0 -0
  139. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/oauth_authorize_response_type.py +0 -0
  140. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/oauth_error.py +0 -0
  141. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/oauth_metadata.py +0 -0
  142. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/oauth_revoke_response_200.py +0 -0
  143. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/proxy_detail.py +0 -0
  144. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/pubproxy_detail.py +0 -0
  145. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/revoke_request.py +0 -0
  146. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/rwhois.py +0 -0
  147. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/satellite_detail.py +0 -0
  148. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/smtp_detail.py +0 -0
  149. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/ssh_detail.py +0 -0
  150. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/token_request.py +0 -0
  151. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/token_response.py +0 -0
  152. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/web_detail.py +0 -0
  153. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/models/whois.py +0 -0
  154. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/_generated/types.py +0 -0
  155. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/bogon.py +0 -0
  156. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/errors.py +0 -0
  157. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/middleware/__init__.py +0 -0
  158. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/middleware/condition.py +0 -0
  159. {internetdata-2.15.1 → internetdata-2.16.0}/src/internetdata/py.typed +0 -0
  160. {internetdata-2.15.1 → internetdata-2.16.0}/testdata/bogons.json +0 -0
  161. {internetdata-2.15.1 → internetdata-2.16.0}/tests/conftest.py +0 -0
  162. {internetdata-2.15.1 → internetdata-2.16.0}/tests/helpers.py +0 -0
  163. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_download.py +0 -0
  164. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_middleware.py +0 -0
  165. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_oauth.py +0 -0
  166. {internetdata-2.15.1 → internetdata-2.16.0}/tests/test_sharing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: internetdata
3
- Version: 2.15.1
3
+ Version: 2.16.0
4
4
  Summary: Official Python client library for the InternetData API. Look up IP addresses, ASNs and domains, and download licensed IP databases.
5
5
  Project-URL: Homepage, https://internetdata.io
6
6
  Project-URL: Documentation, https://docs.internetdata.io
@@ -52,7 +52,7 @@ Requires Python 3.11 or newer. Type hints are included, and the package ships `p
52
52
 
53
53
  ## Usage
54
54
 
55
- **No API key needed to start.** Unlimited, the free plan, answers `location`, `asn`, `company`, `abuse` and every flag but the VPN, proxy, hosting and CDN ones, limited per address per minute, with a key or without one.
55
+ **No API key needed to start.** Unlimited, the free plan, answers `location`, `asn`, `company`, `abuse` and every flag but the VPN, proxy, hosting and CDN ones, with no daily or monthly cap, with a key or without one.
56
56
 
57
57
  ```python
58
58
  from internetdata import InternetData
@@ -74,7 +74,7 @@ with InternetData() as client:
74
74
 
75
75
  ### With an API key
76
76
 
77
- Every paid plan answers every field: the VPN, proxy, hosting and CDN flags, the detail behind each flag, the city, the Whois records and more. The plans differ only in how many lookups they include, and a free account tries every field, 100 lookups a day. Create a key in the [console](https://app.internetdata.io), then pass it in:
77
+ Every paid plan answers every field: the VPN, proxy, hosting and CDN flags, the detail behind each flag, the city, the Whois records and more. The plans differ only in how many lookups they include, and a free account tries every field. Create a key in the [console](https://app.internetdata.io), then pass it in:
78
78
 
79
79
  ```python
80
80
  import os
@@ -122,7 +122,7 @@ print(acct.usage.requests) # 580
122
122
  print(acct.usage.window_end) # when the allowance resets
123
123
  ```
124
124
 
125
- Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the UTC day on the free plan; it is the same number a lookup is gated on. `hard_limit` is `None` on an uncapped plan, which is not the same as zero.
125
+ Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period; on the free plan it counts its trial, the lookups answered with every field. It is the same number a lookup is gated on. `hard_limit` is `None` on an uncapped plan, which is not the same as zero.
126
126
 
127
127
  Both are on the async client too: `await client.my_ip()` and `await client.my_entitlement()`.
128
128
 
@@ -169,6 +169,8 @@ client = InternetData(cache_max_size=50_000, cache_ttl=6 * 60 * 60)
169
169
  client_no_cache = InternetData(cache=False)
170
170
  ```
171
171
 
172
+ An answer with `trial_expired` or `cap_reached` true is cached for a minute at most, so a renewed trial or a raised cap reaches you within a minute.
173
+
172
174
  ### Private and reserved addresses
173
175
 
174
176
  Private, loopback, link-local, documentation and multicast addresses (and their IPv6 equivalents, including the 6to4 and Teredo ranges) are in no database. The library answers them locally, so they cost no request and no quota:
@@ -234,7 +236,7 @@ result = client.lookup("146.70.116.130", timeout=2)
234
236
 
235
237
  **Changed in 2.2.0:** a timeout of 0 or less, NaN or a string used to be accepted, and failed every call.
236
238
 
237
- 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.
239
+ 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. 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.
238
240
 
239
241
  ### Database downloads
240
242
 
@@ -316,7 +318,7 @@ assert hashlib.sha256(raw).hexdigest() == digests["sha256"]
316
318
 
317
319
  #### Download history
318
320
 
319
- `downloads` answers your organization's recent attempts, newest first, refusals included. A denial is what answers "it stopped working", and its absence answers nothing:
321
+ `downloads` answers your organization's recent attempts, newest first, refused ones included, so a download that stopped working shows why:
320
322
 
321
323
  ```python
322
324
  for attempt in client.database.downloads(limit=20):
@@ -350,7 +352,7 @@ if tokens.apikey is None:
350
352
  client = InternetData(tokens.apikey)
351
353
  ```
352
354
 
353
- 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.
355
+ A refusal raises `OauthAccessDeniedError` and a code that ran out raises `OauthExpiredTokenError`. `client.oauth.revoke("your-client-id", tokens.refresh_token)` signs the machine out. Only a client we registered, such as our CLI, can use the device flow: an app of your own signs people in with the authorization code flow below.
354
356
 
355
357
  ### Sign in with OAuth (authorization code)
356
358
 
@@ -387,16 +389,29 @@ Each redirect URI must be https on a public host name, or http on a loopback add
387
389
 
388
390
  ### Fields your plan does not include
389
391
 
390
- 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.
392
+ 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 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.
391
393
 
392
394
  ```python
393
395
  result.flagged("is_hosting") # False rather than None on a plan without it
394
396
  result.is_hosting is None # True on Unlimited: not in your plan
395
397
  result.location.city is None # True on Unlimited
396
- result.trial_expired is True # a free-plan key's daily trial is spent
398
+ result.trial_expired is True # a free-plan key's trial is spent
397
399
  result.cap_reached is True # a paid key is past its overage cap
398
400
  ```
399
401
 
402
+ ### A value the API adds
403
+
404
+ From 2.16.0, a plan's `tier`, a database's `standing` and `license_type`, a version's `formats` and a download's `outcome` and `format` read a value the API adds later as the string served, rather than failing the call. Compare against the values you know and keep a fallback:
405
+
406
+ ```python
407
+ if family.standing == "licensed":
408
+ ... # download it
409
+ elif family.standing not in STANDINGS:
410
+ ... # a standing this release does not know yet
411
+ ```
412
+
413
+ A request still names only the formats in `DATABASE_FORMATS`, and any other is refused before anything is sent.
414
+
400
415
  ## Other Libraries
401
416
 
402
417
  There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, and Ruby. 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
- **No API key needed to start.** Unlimited, the free plan, answers `location`, `asn`, `company`, `abuse` and every flag but the VPN, proxy, hosting and CDN ones, limited per address per minute, with a key or without one.
20
+ **No API key needed to start.** Unlimited, the free plan, answers `location`, `asn`, `company`, `abuse` and every flag but the VPN, proxy, hosting and CDN ones, with no daily or monthly cap, with a key or without one.
21
21
 
22
22
  ```python
23
23
  from internetdata import InternetData
@@ -39,7 +39,7 @@ with InternetData() as client:
39
39
 
40
40
  ### With an API key
41
41
 
42
- Every paid plan answers every field: the VPN, proxy, hosting and CDN flags, the detail behind each flag, the city, the Whois records and more. The plans differ only in how many lookups they include, and a free account tries every field, 100 lookups a day. Create a key in the [console](https://app.internetdata.io), then pass it in:
42
+ Every paid plan answers every field: the VPN, proxy, hosting and CDN flags, the detail behind each flag, the city, the Whois records and more. The plans differ only in how many lookups they include, and a free account tries every field. Create a key in the [console](https://app.internetdata.io), then pass it in:
43
43
 
44
44
  ```python
45
45
  import os
@@ -87,7 +87,7 @@ print(acct.usage.requests) # 580
87
87
  print(acct.usage.window_end) # when the allowance resets
88
88
  ```
89
89
 
90
- Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the UTC day on the free plan; it is the same number a lookup is gated on. `hard_limit` is `None` on an uncapped plan, which is not the same as zero.
90
+ Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period; on the free plan it counts its trial, the lookups answered with every field. It is the same number a lookup is gated on. `hard_limit` is `None` on an uncapped plan, which is not the same as zero.
91
91
 
92
92
  Both are on the async client too: `await client.my_ip()` and `await client.my_entitlement()`.
93
93
 
@@ -134,6 +134,8 @@ client = InternetData(cache_max_size=50_000, cache_ttl=6 * 60 * 60)
134
134
  client_no_cache = InternetData(cache=False)
135
135
  ```
136
136
 
137
+ An answer with `trial_expired` or `cap_reached` true is cached for a minute at most, so a renewed trial or a raised cap reaches you within a minute.
138
+
137
139
  ### Private and reserved addresses
138
140
 
139
141
  Private, loopback, link-local, documentation and multicast addresses (and their IPv6 equivalents, including the 6to4 and Teredo ranges) are in no database. The library answers them locally, so they cost no request and no quota:
@@ -199,7 +201,7 @@ result = client.lookup("146.70.116.130", timeout=2)
199
201
 
200
202
  **Changed in 2.2.0:** a timeout of 0 or less, NaN or a string used to be accepted, and failed every call.
201
203
 
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.
204
+ 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. 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.
203
205
 
204
206
  ### Database downloads
205
207
 
@@ -281,7 +283,7 @@ assert hashlib.sha256(raw).hexdigest() == digests["sha256"]
281
283
 
282
284
  #### Download history
283
285
 
284
- `downloads` answers your organization's recent attempts, newest first, refusals included. A denial is what answers "it stopped working", and its absence answers nothing:
286
+ `downloads` answers your organization's recent attempts, newest first, refused ones included, so a download that stopped working shows why:
285
287
 
286
288
  ```python
287
289
  for attempt in client.database.downloads(limit=20):
@@ -315,7 +317,7 @@ if tokens.apikey is None:
315
317
  client = InternetData(tokens.apikey)
316
318
  ```
317
319
 
318
- 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.
320
+ A refusal raises `OauthAccessDeniedError` and a code that ran out raises `OauthExpiredTokenError`. `client.oauth.revoke("your-client-id", tokens.refresh_token)` signs the machine out. Only a client we registered, such as our CLI, can use the device flow: an app of your own signs people in with the authorization code flow below.
319
321
 
320
322
  ### Sign in with OAuth (authorization code)
321
323
 
@@ -352,16 +354,29 @@ Each redirect URI must be https on a public host name, or http on a loopback add
352
354
 
353
355
  ### Fields your plan does not include
354
356
 
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.
357
+ 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 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.
356
358
 
357
359
  ```python
358
360
  result.flagged("is_hosting") # False rather than None on a plan without it
359
361
  result.is_hosting is None # True on Unlimited: not in your plan
360
362
  result.location.city is None # True on Unlimited
361
- result.trial_expired is True # a free-plan key's daily trial is spent
363
+ result.trial_expired is True # a free-plan key's trial is spent
362
364
  result.cap_reached is True # a paid key is past its overage cap
363
365
  ```
364
366
 
367
+ ### A value the API adds
368
+
369
+ From 2.16.0, a plan's `tier`, a database's `standing` and `license_type`, a version's `formats` and a download's `outcome` and `format` read a value the API adds later as the string served, rather than failing the call. Compare against the values you know and keep a fallback:
370
+
371
+ ```python
372
+ if family.standing == "licensed":
373
+ ... # download it
374
+ elif family.standing not in STANDINGS:
375
+ ... # a standing this release does not know yet
376
+ ```
377
+
378
+ A request still names only the formats in `DATABASE_FORMATS`, and any other is refused before anything is sent.
379
+
365
380
  ## Other Libraries
366
381
 
367
382
  There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, and Ruby. See our GitHub at https://github.com/internetdata for more.
@@ -48,5 +48,32 @@ openapi-python-client generate \
48
48
  # not use anywhere. Normalizing them here keeps generation deterministic.
49
49
  find src/internetdata/_generated -name '*.py' -exec sed -i 's/\xe2\x80\x94/ - /g' {} +
50
50
 
51
+ # A value the API adds to a closed vocabulary in an ANSWER comes back as served rather
52
+ # than failing the whole call, so a release already installed keeps reading the API's
53
+ # answers. Each response enum gains a `_missing_` returning a member that carries the
54
+ # value. A wrong type is still refused, a request still refuses a value outside the
55
+ # pinned list before the network (`models.wire_format`), and a listed file the generator
56
+ # stops emitting stops this script rather than leaving one enum closed.
57
+ for enum in entitlement_plan_tier standing database_format download_outcome \
58
+ database_license_type_type_1 database_license_type_type_2_type_1 \
59
+ database_license_type_type_3_type_1 ; do
60
+ file="src/internetdata/_generated/models/${enum}.py"
61
+ [ -f "$file" ] || { echo "no ${file}: the generated enums moved" >&2 ; exit 1 ; }
62
+ class="$(sed -n 's/^class \([A-Za-z0-9]*\)(StrEnum):$/\1/p' "$file")"
63
+ [ -n "$class" ] || { echo "${file} holds no StrEnum" >&2 ; exit 1 ; }
64
+ cat >> "$file" <<EOF
65
+
66
+ @classmethod
67
+ def _missing_(cls, value: object) -> "${class} | None":
68
+ # A value the API added after this release, handed back as served.
69
+ if not isinstance(value, str):
70
+ return None
71
+ member = str.__new__(cls, value)
72
+ member._name_ = value
73
+ member._value_ = value
74
+ return member
75
+ EOF
76
+ done
77
+
51
78
  echo "src/internetdata/_generated <- spec/openapi.yaml"
52
79
  grep -m1 '^ version:' spec/openapi.yaml
@@ -13,7 +13,7 @@ info:
13
13
  email: support@internetdata.io
14
14
  url: https://internetdata.io
15
15
  termsOfService: https://internetdata.io/terms
16
- version: 2026.11.17
16
+ version: 2026.11.20
17
17
  servers:
18
18
  - url: https://internetdata.io
19
19
  tags:
@@ -97,8 +97,10 @@ paths:
97
97
  operationId: downloadDatabaseV2
98
98
  summary: Download
99
99
  description: |
100
- Answers `302`; the bytes come straight from object storage rather than
101
- through this API. Follow the redirect.
100
+ Downloads one file of a database: the answer is a `302` to time-limited
101
+ object storage, so follow the redirect.
102
+
103
+ The bytes come straight from object storage rather than through this API.
102
104
  security:
103
105
  - ApiKeyQueryAuth: []
104
106
  - ApiKeyHeaderAuth: []
@@ -226,8 +228,8 @@ paths:
226
228
  operationId: listDownloads
227
229
  summary: History
228
230
  description: |
229
- Refusals are listed too: a denial is what answers "it stopped working",
230
- and its absence answers nothing.
231
+ Lists your organization's recent database downloads, newest first,
232
+ refused ones included, so a download that stopped working shows why.
231
233
  security:
232
234
  - ApiKeyQueryAuth: []
233
235
  - ApiKeyHeaderAuth: []
@@ -413,11 +415,10 @@ paths:
413
415
  - Organization
414
416
  summary: Organization
415
417
  description: |
416
- The organization this credential is scoped to.
418
+ Returns the organization the presented credential is scoped to. A
419
+ credential belongs to exactly one, so there is no ID to pass.
417
420
 
418
- There is no way to name a different one. A credential describes exactly
419
- one organization, so an identifier in the path could only ever be your
420
- own or a refusal.
421
+ An identifier in the path could only ever be your own or a refusal.
421
422
  security:
422
423
  - BearerAuth:
423
424
  - org.read
@@ -439,9 +440,10 @@ paths:
439
440
  - Organization
440
441
  summary: Members
441
442
  description: |
442
- Read-only. Adding or removing a member is an invitation flow with email
443
- in the middle rather than a POST, and modeling it as one here would
444
- promise something this API does not do.
443
+ Lists the members of your organization. Adding or removing one is an
444
+ emailed invitation in the console, not an API call.
445
+
446
+ Modeling it as one here would promise something this API does not do.
445
447
  security:
446
448
  - BearerAuth:
447
449
  - org.read
@@ -463,9 +465,11 @@ paths:
463
465
  - API keys
464
466
  summary: List
465
467
  description: |
466
- Metadata only. A key's secret is never in a list - not here and not in
467
- the console - because a list is the response that ends up in logs,
468
- caches and support tickets.
468
+ Lists your organization's API keys with their metadata, never a secret:
469
+ only Create, Rotate and Reveal return one.
470
+
471
+ A secret is never in a list, here or in the console, because a list is
472
+ the response that ends up in logs, caches and support tickets.
469
473
 
470
474
  `retrievable` says whether the secret could still be read back at all.
471
475
  A key issued before this product stored secrets recoverably was never
@@ -491,10 +495,8 @@ paths:
491
495
  - API keys
492
496
  summary: Create
493
497
  description: |
494
- Creates a key and returns its secret.
495
-
496
- This is the only response that ever carries the secret, and only
497
- because this is the moment it comes into existence. Store it now.
498
+ Creates an API key and returns its secret, which no list ever shows:
499
+ keep it, or reveal it again later.
498
500
  security:
499
501
  - BearerAuth:
500
502
  - apikeys.manage
@@ -970,6 +972,8 @@ paths:
970
972
  domain: m247global.com
971
973
  type: hosting
972
974
  prefix: 146.70.116.0/24
975
+ country: RO
976
+ rpki_status: not_found
973
977
  company:
974
978
  name: M247 LTD Vienna Infrastructure
975
979
  domain: m247.ro
@@ -977,7 +981,7 @@ paths:
977
981
  abuse:
978
982
  email: abuse@m247.ro
979
983
  trial:
980
- summary: A free-plan key within its day's trial of every field
984
+ summary: A free-plan key within its trial of every field
981
985
  value:
982
986
  ip: 146.70.116.130
983
987
  is_bogon: false
@@ -1088,7 +1092,7 @@ paths:
1088
1092
  domains: []
1089
1093
  trial_expired: false
1090
1094
  trialExpired:
1091
- summary: A free-plan key past its day's trial, with Unlimited's fields
1095
+ summary: A free-plan key past its trial, with Unlimited's fields
1092
1096
  value:
1093
1097
  ip: 146.70.116.130
1094
1098
  is_bogon: false
@@ -1121,6 +1125,8 @@ paths:
1121
1125
  domain: m247global.com
1122
1126
  type: hosting
1123
1127
  prefix: 146.70.116.0/24
1128
+ country: RO
1129
+ rpki_status: not_found
1124
1130
  company:
1125
1131
  name: M247 LTD Vienna Infrastructure
1126
1132
  domain: m247.ro
@@ -1428,6 +1434,8 @@ paths:
1428
1434
  domain: m247global.com
1429
1435
  type: hosting
1430
1436
  prefix: 146.70.116.0/24
1437
+ country: RO
1438
+ rpki_status: not_found
1431
1439
  company:
1432
1440
  name: M247 LTD Vienna Infrastructure
1433
1441
  domain: m247.ro
@@ -1590,10 +1598,13 @@ paths:
1590
1598
  value:
1591
1599
  error: API key lacks the ip.lookup scope; add Lookups to it in the console
1592
1600
  '429':
1593
- description: |
1594
- A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1595
- per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1596
- Unlimited's fields and `cap_reached` `true`.
1601
+ description: >
1602
+ A rate limit, always with `Retry-After`: this API protecting itself, or a burst of
1603
+ Unlimited
1604
+
1605
+ lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1606
+
1607
+ fields and `cap_reached` `true`.
1597
1608
  content:
1598
1609
  application/json:
1599
1610
  schema:
@@ -1604,13 +1615,9 @@ paths:
1604
1615
  value:
1605
1616
  error: rate limit exceeded
1606
1617
  e2:
1607
- summary: >-
1608
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
1609
- plan
1618
+ summary: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
1610
1619
  value:
1611
- error: >-
1612
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
1613
- plan
1620
+ error: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
1614
1621
  headers:
1615
1622
  Retry-After:
1616
1623
  description: Seconds until a rate limit lets the request through.
@@ -1686,6 +1693,8 @@ paths:
1686
1693
  domain: m247global.com
1687
1694
  type: hosting
1688
1695
  prefix: 146.70.116.0/24
1696
+ country: RO
1697
+ rpki_status: not_found
1689
1698
  company:
1690
1699
  name: M247 LTD Vienna Infrastructure
1691
1700
  domain: m247.ro
@@ -1733,10 +1742,13 @@ paths:
1733
1742
  value:
1734
1743
  error: API key lacks the ip.lookup scope; add Lookups to it in the console
1735
1744
  '429':
1736
- description: |
1737
- A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1738
- per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1739
- Unlimited's fields and `cap_reached` `true`.
1745
+ description: >
1746
+ A rate limit, always with `Retry-After`: this API protecting itself, or a burst of
1747
+ Unlimited
1748
+
1749
+ lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1750
+
1751
+ fields and `cap_reached` `true`.
1740
1752
  content:
1741
1753
  application/json:
1742
1754
  schema:
@@ -1747,13 +1759,9 @@ paths:
1747
1759
  value:
1748
1760
  error: rate limit exceeded
1749
1761
  e2:
1750
- summary: >-
1751
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
1752
- plan
1762
+ summary: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
1753
1763
  value:
1754
- error: >-
1755
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
1756
- plan
1764
+ error: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
1757
1765
  headers:
1758
1766
  Retry-After:
1759
1767
  description: Seconds until a rate limit lets the request through.
@@ -1983,10 +1991,13 @@ paths:
1983
1991
  value:
1984
1992
  error: API key lacks the ip.lookup scope; add Lookups to it in the console
1985
1993
  '429':
1986
- description: |
1987
- A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1988
- per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1989
- Unlimited's fields and `cap_reached` `true`.
1994
+ description: >
1995
+ A rate limit, always with `Retry-After`: this API protecting itself, or a burst of
1996
+ Unlimited
1997
+
1998
+ lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1999
+
2000
+ fields and `cap_reached` `true`.
1990
2001
  content:
1991
2002
  application/json:
1992
2003
  schema:
@@ -1997,13 +2008,9 @@ paths:
1997
2008
  value:
1998
2009
  error: rate limit exceeded
1999
2010
  e2:
2000
- summary: >-
2001
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2002
- plan
2011
+ summary: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2003
2012
  value:
2004
- error: >-
2005
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2006
- plan
2013
+ error: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2007
2014
  headers:
2008
2015
  Retry-After:
2009
2016
  description: Seconds until a rate limit lets the request through.
@@ -2176,10 +2183,13 @@ paths:
2176
2183
  value:
2177
2184
  error: API key lacks the ip.lookup scope; add Lookups to it in the console
2178
2185
  '429':
2179
- description: |
2180
- A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
2181
- per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
2182
- Unlimited's fields and `cap_reached` `true`.
2186
+ description: >
2187
+ A rate limit, always with `Retry-After`: this API protecting itself, or a burst of
2188
+ Unlimited
2189
+
2190
+ lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
2191
+
2192
+ fields and `cap_reached` `true`.
2183
2193
  content:
2184
2194
  application/json:
2185
2195
  schema:
@@ -2190,13 +2200,9 @@ paths:
2190
2200
  value:
2191
2201
  error: rate limit exceeded
2192
2202
  e2:
2193
- summary: >-
2194
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2195
- plan
2203
+ summary: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2196
2204
  value:
2197
- error: >-
2198
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2199
- plan
2205
+ error: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2200
2206
  headers:
2201
2207
  Retry-After:
2202
2208
  description: Seconds until a rate limit lets the request through.
@@ -2495,13 +2501,9 @@ paths:
2495
2501
  value:
2496
2502
  error: rate limit exceeded
2497
2503
  e2:
2498
- summary: >-
2499
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2500
- plan
2504
+ summary: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2501
2505
  value:
2502
- error: >-
2503
- per-minute limit for Unlimited lookups exceeded; retry shortly, or use a paid
2504
- plan
2506
+ error: rate limit for Unlimited lookups exceeded; retry shortly, or use a paid plan
2505
2507
  security:
2506
2508
  - {}
2507
2509
  - apiKeyQuery: []
@@ -2547,10 +2549,10 @@ paths:
2547
2549
  window_end: '2026-10-04T07:00:00Z'
2548
2550
  free:
2549
2551
  summary: >-
2550
- A key of an organization on the free plan, Unlimited: its usage is the day's
2551
- lookups answered with every field, out of the 100 a day its trial has. Nothing
2552
+ A key of an organization on the free plan, Unlimited: its usage is its trial,
2553
+ the lookups answered with every field, out of the quota the trial has. Nothing
2552
2554
  stops it past them, its lookups answering with Unlimited's fields, so there is
2553
- no hard limit, and the window is the UTC day.
2555
+ no hard limit.
2554
2556
  value:
2555
2557
  org_id: f32191d0-ef02-450e-a505-eb5814c35cab
2556
2558
  apikey:
@@ -3678,8 +3680,9 @@ components:
3678
3680
  trial_expired:
3679
3681
  type: boolean
3680
3682
  description: >-
3681
- On every answer to a key on the free plan, and on no other: `false` while the day's
3682
- trial of every field lasts, `true` once the answer has Unlimited's fields.
3683
+ On every answer to a key on the free plan, and on no other: `false` while its
3684
+ organization's trial of every field lasts, `true` once the answer has Unlimited's
3685
+ fields.
3683
3686
  cap_reached:
3684
3687
  type: boolean
3685
3688
  description: >-
@@ -4065,10 +4068,10 @@ components:
4065
4068
  description: The announced prefix covering the address.
4066
4069
  country:
4067
4070
  type: string
4068
- description: The country its registry assigned it to. Paid plans and the trial.
4071
+ description: The country its registry assigned it to.
4069
4072
  rpki_status:
4070
4073
  type: string
4071
- description: The announcement's RPKI status. Paid plans and the trial.
4074
+ description: The announcement's RPKI status.
4072
4075
  required:
4073
4076
  - asn
4074
4077
  - name
@@ -4324,8 +4327,9 @@ components:
4324
4327
  trial_expired:
4325
4328
  type: boolean
4326
4329
  description: >-
4327
- On every answer to a key on the free plan, and on no other: `false` while the day's
4328
- trial of every field lasts, `true` once the answer has Unlimited's fields.
4330
+ On every answer to a key on the free plan, and on no other: `false` while its
4331
+ organization's trial of every field lasts, `true` once the answer has Unlimited's
4332
+ fields.
4329
4333
  cap_reached:
4330
4334
  type: boolean
4331
4335
  description: >-
@@ -4413,8 +4417,9 @@ components:
4413
4417
  trial_expired:
4414
4418
  type: boolean
4415
4419
  description: >-
4416
- On every answer to a key on the free plan, and on no other: `false` while the day's
4417
- trial of every field lasts, `true` once the answer has Unlimited's fields.
4420
+ On every answer to a key on the free plan, and on no other: `false` while its
4421
+ organization's trial of every field lasts, `true` once the answer has Unlimited's
4422
+ fields.
4418
4423
  cap_reached:
4419
4424
  type: boolean
4420
4425
  description: >-
@@ -4686,8 +4691,8 @@ components:
4686
4691
  description: |
4687
4692
  The plan the organization is on, as an identifier that is never
4688
4693
  renamed or reused: `free` for the free plan, or a paid plan's key.
4689
- Compare against it and show `name`. On `free`, usage counts the
4690
- day's lookups answered with every field, its daily trial.
4694
+ Compare against it and show `name`. On `free`, usage counts its
4695
+ trial, the lookups answered with every field.
4691
4696
  example: max
4692
4697
  name:
4693
4698
  type: string
@@ -76,7 +76,7 @@ from .models import (
76
76
  Whois,
77
77
  )
78
78
 
79
- __version__ = "2.15.1"
79
+ __version__ = "2.16.0"
80
80
 
81
81
  __all__ = [
82
82
  "DATABASE_FORMATS",
@@ -23,7 +23,7 @@ from typing import IO, Any, TypeVar, cast
23
23
  from urllib.parse import quote, urlsplit, urlunsplit
24
24
 
25
25
  import httpx
26
- from cachetools import TTLCache
26
+ from cachetools import TLRUCache
27
27
 
28
28
  from ._generated.client import AuthenticatedClient, Client
29
29
  from ._generated.types import UNSET, Unset
@@ -803,19 +803,37 @@ def retry_delay(err: InternetDataError, attempt: int, retries: float) -> float |
803
803
  return _BACKOFF_BASE * (2.0**attempt)
804
804
 
805
805
 
806
+ # The longest a spent trial's or a reached cap's answer is cached, in seconds.
807
+ REDUCED_TTL = 60.0
808
+
809
+
806
810
  class Cache:
807
811
  """A per-client result cache.
808
812
 
809
813
  Never global or static: two clients with different keys are on different plans and
810
814
  entitled to different fields, so a shared cache would serve one of them the other's
811
815
  shape. The lock is not optional, because the sync batch drives lookups from a thread
812
- pool and `TTLCache` is not thread-safe.
816
+ pool and `TLRUCache` is not thread-safe.
817
+
818
+ A reduced answer, a spent trial's or a reached cap's, ends with a renewed trial or a
819
+ raised cap, so it stays a minute at most rather than the TTL. It is still cached, or a
820
+ busy process would send every repeat of an address to the API.
813
821
  """
814
822
 
815
- def __init__(self, max_size: int, ttl: float) -> None:
816
- self._entries: TTLCache[str, Result] = TTLCache(maxsize=max_size, ttl=ttl)
823
+ def __init__(
824
+ self, max_size: int, ttl: float, timer: Callable[[], float] = time.monotonic
825
+ ) -> None:
826
+ self._ttl = ttl
827
+ self._entries: TLRUCache[str, Result] = TLRUCache(
828
+ maxsize=max_size, ttu=self._expires, timer=timer
829
+ )
817
830
  self._lock = threading.Lock()
818
831
 
832
+ def _expires(self, _ip: str, result: Result, now: float) -> float:
833
+ if result.trial_expired is True or result.cap_reached is True:
834
+ return now + min(self._ttl, REDUCED_TTL)
835
+ return now + self._ttl
836
+
819
837
  def get(self, ip: str) -> Result | None:
820
838
  with self._lock:
821
839
  return self._entries.get(ip)