https://github.com/edde746/random-ip-generator
Python package to randomly generate IP by country
https://github.com/edde746/random-ip-generator
data-generator ip-address python
Last synced: about 1 year ago
JSON representation
Python package to randomly generate IP by country
- Host: GitHub
- URL: https://github.com/edde746/random-ip-generator
- Owner: edde746
- License: gpl-3.0
- Created: 2023-03-26T05:25:51.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T17:38:08.000Z (about 3 years ago)
- Last Synced: 2024-10-11T16:11:56.303Z (over 1 year ago)
- Topics: data-generator, ip-address, python
- Language: Python
- Homepage:
- Size: 1.85 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
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.
```python
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}")
```
## 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](https://lite.ip2location.com).