Description
The intelx.py library defaults its API endpoint to https://2.intelx.io. However, free and education users must use the https://free.intelx.io endpoint.
Currently, the constructor (__init__) does not allow specifying a custom host. Users on these free tiers will always receive a 401 Unauthorized error, even with a valid API key, unless they know to manually patch the instance after creation.
Steps to Reproduce
- Be a user with a "free" or "education" API key.
- Initialize the library:
intelx = intelx('YOUR_FREE_API_KEY')
- Run any search:
intelx.search('example.com')
- The request fails with a
401 Unauthorized error.
Current Workaround
The only way to make the library work is to manually change the API_ROOT variable after initializing the class:
import intelxapi
intelx = intelxapi.intelx('API_KEY')
intelx.API_ROOT = 'https://free.intelx.io'
# Now searches will work
results = intelx.search('example.com')
Suggested Fix
- The constructor (
__init__) should be updated to accept an optional host or api_root parameter, which would default to the current 2.intelx.io but allow users to override it.
- The
README.md (documentation) should be updated to mention the new parameter, specifically advising free/education users to set it to https://free.intelx.io.
Example:
# In intelxapi/intelx.py
class intelx():
def __init__(self, key, host='https://2.intelx.io', ua='intelx.py/...'):
self.key = key
self.API_ROOT = host # parameter here
# ... rest of the init
Description
The
intelx.pylibrary defaults its API endpoint tohttps://2.intelx.io. However, free and education users must use thehttps://free.intelx.ioendpoint.Currently, the constructor (
__init__) does not allow specifying a custom host. Users on these free tiers will always receive a401 Unauthorizederror, even with a valid API key, unless they know to manually patch the instance after creation.Steps to Reproduce
intelx = intelx('YOUR_FREE_API_KEY')intelx.search('example.com')401 Unauthorizederror.Current Workaround
The only way to make the library work is to manually change the
API_ROOTvariable after initializing the class:Suggested Fix
__init__) should be updated to accept an optionalhostorapi_rootparameter, which would default to the current2.intelx.iobut allow users to override it.README.md(documentation) should be updated to mention the new parameter, specifically advising free/education users to set it tohttps://free.intelx.io.Example: