Skip to content

About

Python package to randomly generate IP by country

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

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.

About

Python package to randomly generate IP by country

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages