You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix env var API key timing, add select_field param, and clean up packaging
- Defer IPDATA_API_KEY env var lookup from import time to __init__ call
time so setting the env var after import works correctly
- Add select_field parameter to lookup() matching documented PyPI API
- Move pytest, hypothesis, python-dotenv to [test] extras_require
- Make pytricia optional via [trie] extra so core package installs
without a C compiler
- Update README with install extras documentation
- Limit CI publish workflow to master branch and tags only
Closes#32Closes#31Closes#26https://claude.ai/code/session_01M3wRX9tnmc4qorVWRjmqTZ
Makes a GET request to the IPData API for the specified 'resource' and the given 'fields'.
173
175
174
176
:param resource: Either an IP address or an ASN prefixed by "AS" eg. "AS15169"
175
177
:param fields: A collection of API fields to be returned
178
+
:param select_field: A single field name to return (convenience alternative to fields)
176
179
177
180
:returns: An API response as a DotDict object to allow dot notation access of fields eg. data.ip, data.company.name, data.threat.blocklists[0].name etc
178
181
179
182
:raises IPDataException: if the API call fails or if there is a failure in decoding the response.
180
-
:raises ValueError: if 'resource' is not a string
183
+
:raises ValueError: if 'resource' is not a string, or if both 'select_field' and 'fields' are provided
181
184
"""
182
185
iftype(resource) isnotstr:
183
186
raiseValueError(f"{resource} must be of type 'str'")
0 commit comments