Skip to main content

A better way to use IP2Location in Python

Project description

EasyI2L - Easy IP2Location Wrapper

easyi2l is a Python wrapper around the IP2LOCATION library. It allows you to automatically download and load the IP2LOCATION database, simplifying the process of working with IP geolocation data.

Features

  • Automatic Download: Fetches the IP2LOCATION database directly using your IP2LOCATION token.
  • Database Loading: Automatically loads the downloaded database for immediate use.
  • Simple API: Retrieve IP geolocation data with minimal setup.

Installation

Install the package via pip:

pip install easyi2l

Usage

Before using the package, ensure you have the IP2LOCATION_TOKEN environment variable set. You can obtain a token from IP2Location LITE.

Example

Here's a simple example of how to use easyi2l:

from easyi2l import EasyI2L, DBType


db = EasyI2L.download(DBType.DB11LITEBIN).load()

# Retrieve all data for an IP address
print(db.get_all("1.1.1.1"))

Environment Setup

You need to set the IP2LOCATION_TOKEN environment variable for the package to function correctly. The package uses load_dotenv from the dotenv module to load this variable from a .env file in your working directory.

Create a .env file with the following content:

IP2LOCATION_TOKEN=your_token_here

Contributing

Feel free to open issues or submit pull requests to improve the library.

License

This project is licensed under the MIT License.

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

easyi2l-0.0.6.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

easyi2l-0.0.6-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file easyi2l-0.0.6.tar.gz.

File metadata

  • Download URL: easyi2l-0.0.6.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for easyi2l-0.0.6.tar.gz
Algorithm Hash digest
SHA256 97931783c75e005f300e1bc585f5b63786947526f6668399cb72453a69c89c40
MD5 f56d32dafdee9338acb40a4aac397eb0
BLAKE2b-256 dd91004334b80c93eaab0dccb2c41abb4fedf32db6da87f2166e89709a271610

See more details on using hashes here.

File details

Details for the file easyi2l-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: easyi2l-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for easyi2l-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b3f8d87f6c387b21082ee55e4bbba8b6e77f57372be2d34f20554d2fdcb6369f
MD5 4c6135001d6a327e9f01d178766ba5d1
BLAKE2b-256 a170cc7a2ff9e379e9ff626037b9bc717100a6a7236daf3c8b3143f8ee702d0c

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