Skip to main content

IQX Lookup API client for Python

Project description

neivi-iqx-lookup

Official Python client for the IQX Lookup validation and geolocation APIs. Validate emails, phone numbers, VAT IDs, IBANs, BICs, DNS records, SSL certificates, passwords, and credit cards -- with zero external dependencies.

Installation

pip install neivi-iqx-lookup

Or install from source:

git clone https://github.com/Neivi-IT/iqx-lookup-python.git
cd iqx-lookup-python
pip install .

Quick Start

from iqx_lookup import IqxLookup

client = IqxLookup(api_key="your-api-key")

# Validate an email address
email = client.validate_email("user@example.com")
print(email.valid_format)      # True
print(email.disposable_email)  # False

# Geolocate an IP address
geo = client.geolocate_ip("8.8.8.8")
print(geo.country_name)  # "United States"
print(geo.city_name)     # "Mountain View"

# Validate an IBAN
iban = client.validate_iban("DE89370400440532013000")
print(iban.valid)         # True
print(iban.bank_code)     # "37040044"

API Reference

Method Description Returns
validate_email(address) Validate an email address (format, MX, disposable, role) EmailValidationResult
validate_phone(number, country_code=None) Validate a phone number PhoneValidationResult
geolocate_ip(ip=None) Geolocate an IP address (omit for caller's IP) IpGeolocation
validate_vat(country_code, number) Validate an EU VAT number via VIES VatValidationResult
parse_user_agent(ua=None) Parse a user-agent string (omit for SDK's own UA) UserAgentResult
validate_iban(iban) Validate an IBAN IbanValidationResult
validate_bic(bic) Validate a BIC/SWIFT code BicValidationResult
lookup_dns(domain, types=None) Look up DNS records (optionally filter by type, e.g. "A,MX") DnsLookupResult
check_ssl(domain) Check an SSL/TLS certificate SslCertificateResult
analyze_password(password) Analyze password strength PasswordStrengthResult
validate_credit_card(card_number) Validate a credit card number CreditCardValidationResult
last_rate_limit_info Rate limit info from the most recent response (property) `RateLimitInfo

Configuration

from iqx_lookup import IqxLookup

client = IqxLookup(api_key="your-api-key")
Parameter Default Description
api_key (required) API key sent as X-Api-Key header
base_url https://api.iqxlookup.neivi.es API base URL
timeout 10 Request timeout in seconds

The base URL is resolved with priority: explicit parameter > LOOKUP_BASE_URL env var > default. Useful for local development:

export LOOKUP_BASE_URL=http://localhost:8081

Error Handling

The SDK maps HTTP error responses to typed exceptions:

from iqx_lookup import (
    IqxLookup,
    IqxLookupException,
    UnauthorizedException,
    ForbiddenException,
    NotFoundException,
    RateLimitException,
    ServiceUnavailableException,
)

client = IqxLookup(api_key="your-api-key")

try:
    result = client.validate_email("user@example.com")
except UnauthorizedException:
    print("Invalid API key")
except ForbiddenException:
    print("Access denied")
except NotFoundException:
    print("Resource not found")
except RateLimitException as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
    print(f"Limit: {e.limit}, Remaining: {e.remaining}, Reset: {e.reset}")
except ServiceUnavailableException:
    print("Service temporarily unavailable")
except IqxLookupException as e:
    print(f"API error {e.status_code}: {e.error_message}")
Exception HTTP Status Attributes
UnauthorizedException 401 status_code, error_message
ForbiddenException 403 status_code, error_message
NotFoundException 404 status_code, error_message
RateLimitException 429 status_code, error_message, retry_after, limit, remaining, reset
ServiceUnavailableException 503 status_code, error_message
IqxLookupException any status_code, error_message

Rate Limit Information

After each API call, rate limit headers are captured automatically:

result = client.validate_email("user@example.com")

info = client.last_rate_limit_info
if info is not None:
    print(info.limit)      # e.g. 1000
    print(info.remaining)  # e.g. 999
    print(info.reset)      # Unix timestamp

Requirements

  • Python 3.9 or later
  • No external dependencies (stdlib only: urllib, json, dataclasses)

Testing

pip install pytest
pytest

License

Apache License 2.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neivi_iqx_lookup-0.2.1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neivi_iqx_lookup-0.2.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file neivi_iqx_lookup-0.2.1.tar.gz.

File metadata

  • Download URL: neivi_iqx_lookup-0.2.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neivi_iqx_lookup-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0be2d79c2fc706ffcd20769bf5baf9f872de31df00bfc3d0c98fc417543be481
MD5 3836f7b1070bb6a01839f275636c7050
BLAKE2b-256 0db437c85f2c407c23ba12a241e8ac9c9de902c3c893950d7604f40744543ad5

See more details on using hashes here.

File details

Details for the file neivi_iqx_lookup-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for neivi_iqx_lookup-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e60168f0504762a9721b28134f59c90b72a9d29749debbbcd705a2aafa336f
MD5 2441f8943b27d7fb6bd10cc2c8c21edf
BLAKE2b-256 970fb7582a9dd8cc1b32cd5aa68a1f9f425c05bf453fee63db425e59f23a1963

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page