Skip to main content

csplookup

Client library for CSP Lookup API.

Install

pip install csplookup

Usage

from csplookup import CSPClient
from csplookup.errors import MaxLimitReached

client = CSPClient(api_key="YOUR_API_KEY")
res = client.lookup("4.2.2.4")

# check for api errors
try:
    res.check_api_errors()
except MaxLimitReached:
    print("max limit reached")
except Exception as err:
    print("other errors")
# NOTE: check errors file for more exceptions

# get json data:
json_data = res.get_json()
print(json_data)
# country code:
print(json_data["Result"]["Country"]["IsoCode"])
# or
print(res.get_country_code())

Methods

Some helper methods that can help you get the data you need faster:

# get country iso code
print(res.get_country_code())

# get country name (in english):
print(res.get_country_en_name())

# get city name (in english):
print(res.get_city_en_name())

License

MIT

Metadata

Release files for csplookup 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csplookup 1.4
File Size Uploaded Provenance Actions
csplookup-1.4.tar.gz 2.9 kB Without provenance Details for csplookup-1.4.tar.gz

Release files / csplookup-1.4.tar.gz

Download URL csplookup-1.4.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cce0590c59003d3ecc3acfb0ed3e430befe2e70823bae91722aea441aebb0234
BLAKE2b-256 checksum
How to use checksums
622a349893d4c58cb05a69a6f317b981018f3670bdfff7847a604d6c74ea88a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

Security for csplookup 1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page