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.0.1.tar.gz
(716.7 kB
view hashes)
Built Distribution
yzhanurlparser-0.0.1-py3-none-any.whl
(715.9 kB
view hashes)
Close
Hashes for yzhanurlparser-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbdf98b67520cc4266d96d13baff5d1e39f7fbe5a9c86b9a7fb4db3de3e0ba02 |
|
MD5 | 3bf07df511d8ee162b7cb07106dfccf0 |
|
BLAKE2b-256 | 666888366c52928c7ddc4d9e87ea97397357add4e1d2bd92fb92a88e9be6a4b2 |