Skip to main content

A Python library to fetch public and private IP addresses.

Project description

IP Fetcher

License: MIT PyPI - Version PyPI - Downloads

ip_fetcher is a Python library for retrieving public and private IP addresses, checking IP types, and detecting proxies or VPNs. It also provides a command-line interface (CLI) for ease of use.

Features

  • Fetches Public IP Address: Retrieves the public IP address of the user.
  • Retrieves Private IP Address: Retrieves the private IP address of the user.
  • Checks IP Type: Determines if a given IP address is IPv4 or IPv6.
  • Detects Proxy or VPN: Checks if a given IP address is associated with a known proxy or VPN.
  • Command-Line Interface: Provides a CLI for quick access to the library's functionalities.

Installation

To install the package, use:

pip install ip_fetcher

Changelog

0.3.3 (2024-09-15)

  • Updated setup.py Requirements: Changed Python version requirement to >=3.9.7.
  • Improved CLI: Enhanced error handling and command functionality; fixed issues from versions 0.3.2 and 0.3.2.9.
  • Created Changelog Section: Added a changelog.

Usage

Here are some examples of how to use the ip_fetcher library:

Fetching the Public IP

To get your public IP address:

from ip_fetcher import get_public_ip

public_ip = get_public_ip()
print(f"Public IP: {public_ip}")

Fetching the Private IP

To get your private IP address:

from ip_fetcher import get_private_ip

private_ip = get_private_ip()
print(f"Private IP: {private_ip}")

Checking IP Type

To check if an IP address is IPv4 or IPv6:

from ip_fetcher import is_ipv4, is_ipv6

ip_address = "192.168.1.1"

if is_ipv4(ip_address):
    print(f"{ip_address} is an IPv4 address.")
elif is_ipv6(ip_address):
    print(f"{ip_address} is an IPv6 address.")
else:
    print(f"{ip_address} is not a valid IP address.")

Checking for Proxy or VPN

To check if an IP address is associated with a proxy or VPN:

from ip_fetcher import check_ip_proxy_vpn

ip_address = "8.8.8.8"

if check_ip_proxy_vpn(ip_address):
    print(f"{ip_address} is associated with a proxy or VPN.")
else:
    print(f"{ip_address} is not associated with a proxy or VPN.")

Command-Line Interface (CLI)

After installing the package, you can use the command-line interface to access the library's functionalities directly from the terminal.

Fetch Public IP

ip-fetcher --public

Fetch Private IP

ip-fetcher --private

Fetch Both Public and Private IPs

ip-fetcher --public --private

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

ip_fetcher-0.3.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

ip_fetcher-0.3.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file ip_fetcher-0.3.3.tar.gz.

File metadata

  • Download URL: ip_fetcher-0.3.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.7

File hashes

Hashes for ip_fetcher-0.3.3.tar.gz
Algorithm Hash digest
SHA256 6bbe1fc649ede9aebc751c9387d83b414b89b12e73388d68a9ae7f386a6ed343
MD5 79c24ac5ba7b8e4e17163ce39191bb76
BLAKE2b-256 390c23701d366a449a87ce9320350c275868904bb7b7fb63290ccf49cae34b70

See more details on using hashes here.

File details

Details for the file ip_fetcher-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: ip_fetcher-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.7

File hashes

Hashes for ip_fetcher-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d6f374d321d826686cff25981cfbd034fb1e079c37e7a7db619f16825040f88b
MD5 d20af5893649ec7c95b6f023e2fa76ee
BLAKE2b-256 31bf85da7c7c5406d17c7068d0e144d86af887426477b0af5099221d4cb3763c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page