-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
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 Unauthorizederror.
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 optionalhostorapi_rootparameter, which would default to the current2.intelx.iobut 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 tohttps://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 initReactions are currently unavailable