A package to generate random IP addresses for a given country code
Project description
Random IP Generator
Random IP Generator is a Python package that generates a random IP address for a given country code. It uses the IP2LOCATION-LITE-DB1.CSV file as a source for IP ranges per country.
Installation
You can install the package via pip:
pip install random-ip-generator
Usage
After installing the package, you can use the random_ip_for_country function in your Python script to generate a random IP address for a given country.
from random_ip_generator import random_ip_for_country
country_code = "US"
random_ip = random_ip_for_country(country_code)
print(f"Random IP for {country_code}: {random_ip}")
get_country_codes() will return an alphabetically sorted list of country codes:
from random_ip_generator import get_country_codes
print(get_country_codes())
random_ip() will return a random ip from a random country:
from random_ip_generator import random_ip
print(random_ip())
Prerequisites
This package requires the ipaddress package. It will be installed automatically if you install random-ip-generator via pip.
Attribution
This site or product includes IP2Location LITE data available from https://lite.ip2location.com.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file random_ip_generator-0.2.0.tar.gz.
File metadata
- Download URL: random_ip_generator-0.2.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee50d1d62d433923a4f9c54d607a6ee4bc141bc3e8f55c4c379e1cb25790d67
|
|
| MD5 |
45a0509f4172cf89493516a4bcc5dc61
|
|
| BLAKE2b-256 |
6292c1c4cfa179936ae8d8ae3050a2598f8314d1cfed8019c809767d4d05ce14
|
File details
Details for the file random_ip_generator-0.2.0-py3-none-any.whl.
File metadata
- Download URL: random_ip_generator-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad11972c2f22c5eae9a125aaaf4f57d5f3c1e0c25562c38162bddff879d55482
|
|
| MD5 |
69eabff39c212845c3d18f414d4b6c24
|
|
| BLAKE2b-256 |
3de4e8b260978dd36c201ea34ba2f55e0ddf5a8602d5e8f0e8186041b857bb85
|