A python library which could parse URL to ip and country.
Project description
yzhanURLParser
A python library which could parse URL to ip and country.
Usage
Install
pip install yzhanurlparser
API
Is IP
from yzhanurlparser import is_ip
is_ip('123') # False
is_ip('8.8.8.8') # True
Get Info By IP
from yzhanurlparser import get_info_by_ip
get_info_by_ip('8.8.8.8')
# {'ip': '8.8.8.8', 'country_short': 'US', 'country_long': 'United States of America'}
Get Country By IP
from yzhanurlparser import get_country_by_ip
get_country_by_ip('8.8.8.8') # US
get_country_by_ip('114.114.114.114') # CN
Get Info By URL
from yzhanurlparser import get_info_by_url
get_info_by_url('https://www.163.com')
# {'ip': '183.3.203.247', 'country_short': 'CN', 'country_long': 'China'}
Get Country By URL
from yzhanurlparser import get_country_by_url
get_country_by_url('https://www.163.com') # CN
Development
Install
pip install -r requirements.txt
Unit Test
cd yzhanurlparser
python -m unittest discover -s test -p '*_test.py'
Build
pip install --user --upgrade setuptools wheel twine # First Run
python setup.py sdist bdist_wheel
Thanks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yzhanurlparser-0.1.0.tar.gz
(716.9 kB
view details)
Built Distribution
File details
Details for the file yzhanurlparser-0.1.0.tar.gz
.
File metadata
- Download URL: yzhanurlparser-0.1.0.tar.gz
- Upload date:
- Size: 716.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3205f132041a7f2fdf3e72250317ca11da0259f92d442935ce93d5fa0db893b1 |
|
MD5 | 054a88c9675804047bb8a2de9df6617c |
|
BLAKE2b-256 | 6574eabe3bda53d4ca030de6bc50183197b8cdde2121e3ed8d27560cf4f50a19 |
File details
Details for the file yzhanurlparser-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: yzhanurlparser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 715.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697f6f19d4cd729234635d04052b49b3fe430706c96588ac30f990e928b66830 |
|
MD5 | f858216858c51023b32a36d252cf2afe |
|
BLAKE2b-256 | 1cb467be1d3ab5f4e3f00ced4d3ea9a7ed4131ce5099dc33ac9fbfc5b795ac0c |