IP2Proxy D API#

IP2Proxy Class#

class IP2Proxy(binpath)#

Construct the IP2Location Class. Load the IP2Proxy BIN database for lookup.

Parameters:

binPath (str) – (Required) The file path links to IP2Proxy BIN databases.

package_version()#

Return the database’s type, 1 to 10 respectively for PX1 to PX11. Please visit https://www.ip2location.com/databases/ip2proxy for details.

Returns:

Returns the package version.

Return type:

string

module_version()#

Return the version of module.

Returns:

Returns the module version.

Return type:

string

database_version()#

Return the database’s compilation date as a string of the form ‘YYYY-MM-DD’.

Returns:

Returns the database version.

Return type:

string

close()#

Closes BIN file and resets metadata.

get_all(ipaddress)#

Retrieve geolocation information for an IP address.

Parameters:

ipaddress (string) – (Required) The IP address (IPv4 or IPv6).

Returns:

Returns the geolocation information in array. Refer below table for the fields avaliable in the array

Return type:

array

RETURN FIELDS

Field Name

Description

CountryShort

Two-character country code based on ISO 3166.

CountryLong

Country name based on ISO 3166.

Region

Region or state name.

City

City name.

ISP

Internet Service Provider or company’s name.

Domain

Internet domain name associated with IP address range.

UsageType

Usage type classification of ISP or company.

ASN

Autonomous system number (ASN).

AS

Autonomous system (AS) name.

LastSeen

Proxy last seen in days.

Threat

Security threat reported.

ProxyType

Type of proxy.

Provider

Name of VPN provider if available.