Skip to content

Bug: API endpoint defaults to 2.intelx.io, needs option for free.intelx.io for free/edu users. #583

@Jorgesu040

Description

@Jorgesu040

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

  1. Be a user with a "free" or "education" API key.
  2. Initialize the library: intelx = intelx('YOUR_FREE_API_KEY')
  3. Run any search: intelx.search('example.com')
  4. 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

  1. 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.
  2. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions