%global _empty_manifest_terminate_build 0
Name: python-IP2Proxy
Version: 3.4.0
Release: 1
Summary: Python API for IP2Proxy database. It can be used to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.
License: MIT License
URL: https://github.com/ip2location/ip2proxy-python
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/12/08/dd0a6180c9fb60a740d3694c54d231d8ff727dc31a826f72a4fdcb539b25/IP2Proxy-3.4.0.tar.gz
BuildArch: noarch
%description
# IP2Proxy Python Library
This library allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
* Free IP2Proxy BIN Data: https://lite.ip2location.com
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
For more details, please visit:
[https://www.ip2location.com/ip2proxy/developers/python](https://www.ip2location.com/ip2proxy/developers/python)
## Methods
Below are the methods supported in this library.
|Method Name|Description|
|---|---|
|open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
|close|Close and clean up the file pointer.|
|get_package_version|Get the package version (1 to 11 for PX1 to PX11 respectively).|
|get_module_version|Get the module version.|
|get_database_version|Get the database version.|
|is_proxy|Check whether if an IP address was a proxy. Returned value:
- -1 : errors
- 0 : not a proxy
- 1 : a proxy
- 2 : a data center IP address
|
|get_all|Return the proxy information in array.|
|get_proxy_type|Return the proxy type. Please visit IP2Location for the list of proxy types supported|
|get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
|get_country_long|Return the ISO3166-1 country name of the proxy.|
|get_region|Return the ISO3166-2 region name of the proxy. Please visit ISO3166-2 Subdivision Code for the information of ISO3166-2 supported|
|get_city|Return the city name of the proxy.|
|get_isp|Return the ISP name of the proxy.|
|get_domain|Return the domain name of proxy's IP address or domain name.|
|get_usage_type|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](https://github.com/ip2location/ip2proxy-python#usage-type) for details.|
|get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
|get_as_name|Return the autonomous system (AS) name of proxy's IP address or domain name.|
|get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
|get_threat|Return the threat types reported to proxy's IP address or domain name.|
|get_provider|Returns the VPN service provider name if available.|
## Web Service
Below is the description of the functions available in the **Web Service** lookup.
| Method Name | Description |
| ----------- | ------------------------------------------------------------ |
| Constructor | Expect 3 input parameters:- IP2Proxy API Key.
- Package (PX1 - PX11)
- Use HTTPS or HTTP
|
| lookup | Return the proxy information in array.- countryCode
- countryName
- regionName
- cityName
- isp
- domain
- usageType
- asn
- as
- lastSeen
- threat
- proxyType
- isProxy
|
| getcredit | Return remaining credit of the web service account. |
## Requirements
1. Python 2.2 and above
## Installation
1. Unzip the package.
2. Execute python setup.py build
3. Execute python setup.py install
or
To install this module type the following (for PyPI):
pip install IP2Proxy
## Usage
```python
import IP2Proxy
db = IP2Proxy.IP2Proxy()
# open IP2Proxy BIN database for proxy lookup
db.open("IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.BIN")
# get versioning information
print ('Module Version: ' + db.get_module_version())
print ('Package Version: ' + db.get_package_version())
print ('Database Version: ' + db.get_database_version())
# individual proxy data check
print ('Is Proxy: ' + str(db.is_proxy("4.0.0.47")))
print ('Proxy Type: ' + db.get_proxy_type("4.0.0.47"))
print ('Country Code: ' + db.get_country_short("4.0.0.47"))
print ('Country Name: ' + db.get_country_long("4.0.0.47"))
print ('Region Name: ' + db.get_region("4.0.0.47"))
print ('City Name: ' + db.get_city("4.0.0.47"))
print ('ISP: ' + db.get_isp("4.0.0.47"))
print ('Domain: ' + db.get_domain("4.0.0.47"))
print ('Usage Type: ' + db.get_usage_type("4.0.0.47"))
print ('ASN: ' + db.get_asn("4.0.0.47"))
print ('AS Name: ' + db.get_as_name("4.0.0.47"))
print ('Last Seen: ' + db.get_last_seen("4.0.0.47"))
print ('Threat: ' + db.get_threat("4.0.0.47"))
print ('Provider: ' + db.get_provider("4.0.0.47"))
# single function to get all proxy data returned in array
record = db.get_all("4.0.0.47")
print ('Is Proxy: ' + str(record['is_proxy']))
print ('Proxy Type: ' + record['proxy_type'])
print ('Country Code: ' + record['country_short'])
print ('Country Name: ' + record['country_long'])
print ('Region Name: ' + record['region'])
print ('City Name: ' + record['city'])
print ('ISP: ' + record['isp'])
print ('Domain: ' + record['domain'])
print ('Usage Type: ' + record['usage_type'])
print ('ASN: ' + record['asn'])
print ('AS Name: ' + record['as_name'])
print ('Last Seen: ' + record['last_seen'])
print ('Threat: ' + record['threat'])
print ('Provider: ' + record['provider'])
# close IP2Proxy BIN database
db.close()
# Web Service
ws = IP2Proxy.IP2ProxyWebService("demo","PX11",True)
rec = ws.lookup("8.8.8.8")
print (rec)
print ("\n")
print ("Credit Remaining: {}\n".format(ws.getcredit()))
```
## Proxy Type
| Proxy Type | Description |
| ---------- | ------------------------------ |
| VPN | Anonymizing VPN services. |
| TOR | Tor Exit Nodes. |
| PUB | Public Proxies. |
| WEB | Web Proxies. |
| DCH | Hosting Providers/Data Center. |
| SES | Search Engine Robots. |
| RES | Residential Proxies [PX10+] |
## Usage Type
| Usage Type | Description |
| ---------- | ------------------------------- |
| COM | Commercial |
| ORG | Organization |
| GOV | Government |
| MIL | Military |
| EDU | University/College/School |
| LIB | Library |
| CDN | Content Delivery Network |
| ISP | Fixed Line ISP |
| MOB | Mobile ISP |
| DCH | Data Center/Web Hosting/Transit |
| SES | Search Engine Spider |
| RSV | Reserved |
## Threat Type
| Threat Type | Description |
| ----------- | -------------------------- |
| SPAM | Spammer |
| SCANNER | Security Scanner or Attack |
| BOTNET | Spyware or Malware |
## Support
Email: support@ip2location.com.
URL: [https://www.ip2location.com](https://www.ip2location.com)
%package -n python3-IP2Proxy
Summary: Python API for IP2Proxy database. It can be used to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.
Provides: python-IP2Proxy
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-IP2Proxy
# IP2Proxy Python Library
This library allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
* Free IP2Proxy BIN Data: https://lite.ip2location.com
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
For more details, please visit:
[https://www.ip2location.com/ip2proxy/developers/python](https://www.ip2location.com/ip2proxy/developers/python)
## Methods
Below are the methods supported in this library.
|Method Name|Description|
|---|---|
|open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
|close|Close and clean up the file pointer.|
|get_package_version|Get the package version (1 to 11 for PX1 to PX11 respectively).|
|get_module_version|Get the module version.|
|get_database_version|Get the database version.|
|is_proxy|Check whether if an IP address was a proxy. Returned value:- -1 : errors
- 0 : not a proxy
- 1 : a proxy
- 2 : a data center IP address
|
|get_all|Return the proxy information in array.|
|get_proxy_type|Return the proxy type. Please visit IP2Location for the list of proxy types supported|
|get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
|get_country_long|Return the ISO3166-1 country name of the proxy.|
|get_region|Return the ISO3166-2 region name of the proxy. Please visit ISO3166-2 Subdivision Code for the information of ISO3166-2 supported|
|get_city|Return the city name of the proxy.|
|get_isp|Return the ISP name of the proxy.|
|get_domain|Return the domain name of proxy's IP address or domain name.|
|get_usage_type|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](https://github.com/ip2location/ip2proxy-python#usage-type) for details.|
|get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
|get_as_name|Return the autonomous system (AS) name of proxy's IP address or domain name.|
|get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
|get_threat|Return the threat types reported to proxy's IP address or domain name.|
|get_provider|Returns the VPN service provider name if available.|
## Web Service
Below is the description of the functions available in the **Web Service** lookup.
| Method Name | Description |
| ----------- | ------------------------------------------------------------ |
| Constructor | Expect 3 input parameters:- IP2Proxy API Key.
- Package (PX1 - PX11)
- Use HTTPS or HTTP
|
| lookup | Return the proxy information in array.- countryCode
- countryName
- regionName
- cityName
- isp
- domain
- usageType
- asn
- as
- lastSeen
- threat
- proxyType
- isProxy
|
| getcredit | Return remaining credit of the web service account. |
## Requirements
1. Python 2.2 and above
## Installation
1. Unzip the package.
2. Execute python setup.py build
3. Execute python setup.py install
or
To install this module type the following (for PyPI):
pip install IP2Proxy
## Usage
```python
import IP2Proxy
db = IP2Proxy.IP2Proxy()
# open IP2Proxy BIN database for proxy lookup
db.open("IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.BIN")
# get versioning information
print ('Module Version: ' + db.get_module_version())
print ('Package Version: ' + db.get_package_version())
print ('Database Version: ' + db.get_database_version())
# individual proxy data check
print ('Is Proxy: ' + str(db.is_proxy("4.0.0.47")))
print ('Proxy Type: ' + db.get_proxy_type("4.0.0.47"))
print ('Country Code: ' + db.get_country_short("4.0.0.47"))
print ('Country Name: ' + db.get_country_long("4.0.0.47"))
print ('Region Name: ' + db.get_region("4.0.0.47"))
print ('City Name: ' + db.get_city("4.0.0.47"))
print ('ISP: ' + db.get_isp("4.0.0.47"))
print ('Domain: ' + db.get_domain("4.0.0.47"))
print ('Usage Type: ' + db.get_usage_type("4.0.0.47"))
print ('ASN: ' + db.get_asn("4.0.0.47"))
print ('AS Name: ' + db.get_as_name("4.0.0.47"))
print ('Last Seen: ' + db.get_last_seen("4.0.0.47"))
print ('Threat: ' + db.get_threat("4.0.0.47"))
print ('Provider: ' + db.get_provider("4.0.0.47"))
# single function to get all proxy data returned in array
record = db.get_all("4.0.0.47")
print ('Is Proxy: ' + str(record['is_proxy']))
print ('Proxy Type: ' + record['proxy_type'])
print ('Country Code: ' + record['country_short'])
print ('Country Name: ' + record['country_long'])
print ('Region Name: ' + record['region'])
print ('City Name: ' + record['city'])
print ('ISP: ' + record['isp'])
print ('Domain: ' + record['domain'])
print ('Usage Type: ' + record['usage_type'])
print ('ASN: ' + record['asn'])
print ('AS Name: ' + record['as_name'])
print ('Last Seen: ' + record['last_seen'])
print ('Threat: ' + record['threat'])
print ('Provider: ' + record['provider'])
# close IP2Proxy BIN database
db.close()
# Web Service
ws = IP2Proxy.IP2ProxyWebService("demo","PX11",True)
rec = ws.lookup("8.8.8.8")
print (rec)
print ("\n")
print ("Credit Remaining: {}\n".format(ws.getcredit()))
```
## Proxy Type
| Proxy Type | Description |
| ---------- | ------------------------------ |
| VPN | Anonymizing VPN services. |
| TOR | Tor Exit Nodes. |
| PUB | Public Proxies. |
| WEB | Web Proxies. |
| DCH | Hosting Providers/Data Center. |
| SES | Search Engine Robots. |
| RES | Residential Proxies [PX10+] |
## Usage Type
| Usage Type | Description |
| ---------- | ------------------------------- |
| COM | Commercial |
| ORG | Organization |
| GOV | Government |
| MIL | Military |
| EDU | University/College/School |
| LIB | Library |
| CDN | Content Delivery Network |
| ISP | Fixed Line ISP |
| MOB | Mobile ISP |
| DCH | Data Center/Web Hosting/Transit |
| SES | Search Engine Spider |
| RSV | Reserved |
## Threat Type
| Threat Type | Description |
| ----------- | -------------------------- |
| SPAM | Spammer |
| SCANNER | Security Scanner or Attack |
| BOTNET | Spyware or Malware |
## Support
Email: support@ip2location.com.
URL: [https://www.ip2location.com](https://www.ip2location.com)
%package help
Summary: Development documents and examples for IP2Proxy
Provides: python3-IP2Proxy-doc
%description help
# IP2Proxy Python Library
This library allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
* Free IP2Proxy BIN Data: https://lite.ip2location.com
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
For more details, please visit:
[https://www.ip2location.com/ip2proxy/developers/python](https://www.ip2location.com/ip2proxy/developers/python)
## Methods
Below are the methods supported in this library.
|Method Name|Description|
|---|---|
|open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
|close|Close and clean up the file pointer.|
|get_package_version|Get the package version (1 to 11 for PX1 to PX11 respectively).|
|get_module_version|Get the module version.|
|get_database_version|Get the database version.|
|is_proxy|Check whether if an IP address was a proxy. Returned value:- -1 : errors
- 0 : not a proxy
- 1 : a proxy
- 2 : a data center IP address
|
|get_all|Return the proxy information in array.|
|get_proxy_type|Return the proxy type. Please visit IP2Location for the list of proxy types supported|
|get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
|get_country_long|Return the ISO3166-1 country name of the proxy.|
|get_region|Return the ISO3166-2 region name of the proxy. Please visit ISO3166-2 Subdivision Code for the information of ISO3166-2 supported|
|get_city|Return the city name of the proxy.|
|get_isp|Return the ISP name of the proxy.|
|get_domain|Return the domain name of proxy's IP address or domain name.|
|get_usage_type|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](https://github.com/ip2location/ip2proxy-python#usage-type) for details.|
|get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
|get_as_name|Return the autonomous system (AS) name of proxy's IP address or domain name.|
|get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
|get_threat|Return the threat types reported to proxy's IP address or domain name.|
|get_provider|Returns the VPN service provider name if available.|
## Web Service
Below is the description of the functions available in the **Web Service** lookup.
| Method Name | Description |
| ----------- | ------------------------------------------------------------ |
| Constructor | Expect 3 input parameters:- IP2Proxy API Key.
- Package (PX1 - PX11)
- Use HTTPS or HTTP
|
| lookup | Return the proxy information in array.- countryCode
- countryName
- regionName
- cityName
- isp
- domain
- usageType
- asn
- as
- lastSeen
- threat
- proxyType
- isProxy
|
| getcredit | Return remaining credit of the web service account. |
## Requirements
1. Python 2.2 and above
## Installation
1. Unzip the package.
2. Execute python setup.py build
3. Execute python setup.py install
or
To install this module type the following (for PyPI):
pip install IP2Proxy
## Usage
```python
import IP2Proxy
db = IP2Proxy.IP2Proxy()
# open IP2Proxy BIN database for proxy lookup
db.open("IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.BIN")
# get versioning information
print ('Module Version: ' + db.get_module_version())
print ('Package Version: ' + db.get_package_version())
print ('Database Version: ' + db.get_database_version())
# individual proxy data check
print ('Is Proxy: ' + str(db.is_proxy("4.0.0.47")))
print ('Proxy Type: ' + db.get_proxy_type("4.0.0.47"))
print ('Country Code: ' + db.get_country_short("4.0.0.47"))
print ('Country Name: ' + db.get_country_long("4.0.0.47"))
print ('Region Name: ' + db.get_region("4.0.0.47"))
print ('City Name: ' + db.get_city("4.0.0.47"))
print ('ISP: ' + db.get_isp("4.0.0.47"))
print ('Domain: ' + db.get_domain("4.0.0.47"))
print ('Usage Type: ' + db.get_usage_type("4.0.0.47"))
print ('ASN: ' + db.get_asn("4.0.0.47"))
print ('AS Name: ' + db.get_as_name("4.0.0.47"))
print ('Last Seen: ' + db.get_last_seen("4.0.0.47"))
print ('Threat: ' + db.get_threat("4.0.0.47"))
print ('Provider: ' + db.get_provider("4.0.0.47"))
# single function to get all proxy data returned in array
record = db.get_all("4.0.0.47")
print ('Is Proxy: ' + str(record['is_proxy']))
print ('Proxy Type: ' + record['proxy_type'])
print ('Country Code: ' + record['country_short'])
print ('Country Name: ' + record['country_long'])
print ('Region Name: ' + record['region'])
print ('City Name: ' + record['city'])
print ('ISP: ' + record['isp'])
print ('Domain: ' + record['domain'])
print ('Usage Type: ' + record['usage_type'])
print ('ASN: ' + record['asn'])
print ('AS Name: ' + record['as_name'])
print ('Last Seen: ' + record['last_seen'])
print ('Threat: ' + record['threat'])
print ('Provider: ' + record['provider'])
# close IP2Proxy BIN database
db.close()
# Web Service
ws = IP2Proxy.IP2ProxyWebService("demo","PX11",True)
rec = ws.lookup("8.8.8.8")
print (rec)
print ("\n")
print ("Credit Remaining: {}\n".format(ws.getcredit()))
```
## Proxy Type
| Proxy Type | Description |
| ---------- | ------------------------------ |
| VPN | Anonymizing VPN services. |
| TOR | Tor Exit Nodes. |
| PUB | Public Proxies. |
| WEB | Web Proxies. |
| DCH | Hosting Providers/Data Center. |
| SES | Search Engine Robots. |
| RES | Residential Proxies [PX10+] |
## Usage Type
| Usage Type | Description |
| ---------- | ------------------------------- |
| COM | Commercial |
| ORG | Organization |
| GOV | Government |
| MIL | Military |
| EDU | University/College/School |
| LIB | Library |
| CDN | Content Delivery Network |
| ISP | Fixed Line ISP |
| MOB | Mobile ISP |
| DCH | Data Center/Web Hosting/Transit |
| SES | Search Engine Spider |
| RSV | Reserved |
## Threat Type
| Threat Type | Description |
| ----------- | -------------------------- |
| SPAM | Spammer |
| SCANNER | Security Scanner or Attack |
| BOTNET | Spyware or Malware |
## Support
Email: support@ip2location.com.
URL: [https://www.ip2location.com](https://www.ip2location.com)
%prep
%autosetup -n IP2Proxy-3.4.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-IP2Proxy -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue May 30 2023 Python_Bot - 3.4.0-1
- Package Spec generated