abstract_api.ip_geolocation package#

Submodules#

Module contents#

class abstract_api.ip_geolocation.IPGeolocation(*, response_fields: Iterable[str] | None = None, **kwargs)[source]#

Bases: ResponseFieldsMixin, BaseService[IPGeolocationResponse]

AbstractAPI IP geolocation service.

Used to determine the location and other details of IP addresses.

Attributes:

_subdomain: IP Geolocation service subdomain. _response_fields: Selected response fields to be returned from IP

Geolocation service endpoint.

check(ip: str, fields: Iterable[str] | None = None) IPGeolocationResponse[source]#

Analyzes an IP address for geographical data.

Args:

ip: A valid IP address to analyze. fields: Selected response fields (optional).

Returns:

IPGeolocationResponse representing API call response.

class abstract_api.ip_geolocation.IPGeolocationResponse(response: Response, response_fields: frozenset[str], list_response: bool = False)[source]#

Bases: NestedEntitiesMixin, JSONResponse

IP Geolocation service response.

property city: str | None#

City’s name.

property city_geoname_id: int | None#

City’s geoname ID.

property connection: Connection | None#

Connection details.

property continent: str | None#

Continent’s name.

property continent_code: str | None#

2 letter continent code: AF, AS, EU, NA, OC, SA, AN.

property continent_geoname_id: int | None#

Continent’s geoname ID.

property country: str | None#

Country’s name.

property country_code: str | None#

Country’s ISO 3166-1 alpha-2 code.

property country_geoname_id: int | None#

Country’s geoname ID.

property country_is_eu: bool | None#

True if the country is in the EU, false if it is not.

property currency: Currency | None#

Currency details.

property flag: Flag | None#

Flag details.

property ip_address: str | None#

The IP address submitted for geolocation.

property latitude: float | None#

Decimal of the latitude.

property longitude: float | None#

Decimal of the longitude.

property postal_code: str | None#

ZIP or postal code.

property region: str | None#

State or province in which the city is located.

property region_geoname_id: int | None#

State or province’s geoname ID.

property region_iso_code: str | None#

State or province’s ISO 3166-2 code.

property security: Security | None#

Whether the IP address is using from a VPN or using a proxy.

property timezone: Timezone | None#

Timezone details.