nokey.geolocation package
Submodules
nokey.geolocation.ip_api module
- class nokey.geolocation.ip_api.IP_API(use_caching=False, cache_name='ip_api_cache', backend='sqlite', expire_after=3600)[source]
Bases:
objectA class to interact with the IP API.
- base_url
The base URL of IP API.
- about
A short description of the API.
nokey.geolocation.zippopotamus module
- class nokey.geolocation.zippopotamus.Zippopotomus(use_caching=False, cache_name='zippopotomus_cache', backend='sqlite', expire_after=3600)[source]
Bases:
objectA class to interact with the Zippopotomus API.
- base_url
The basee URL of the API.
- about
A short description of the API.
- get_docs_url()[source]
Returns the URL for the Zippopotomus API documentation.
- Parameters:
None –
- Returns:
The URL for the API docs.
- Return type:
string
- get_info_by_zipcode(country, zipcode)[source]
Returns information on a given zipcode in a given country.
- Parameters:
country (str) – The country code as defined in the API docs. See docs for supported countries.
zipcode (int) – The zipcode in question. See docs for range and format of zipcodes by country.
- Returns:
A dictionary containing information about the given zipcode in the given country.
- Return type:
dict
- get_zipcode_by_city(country, state, city)[source]
Returns the zipcode(s) of the city matching the parameters.
- Parameters:
country (str) – The country code as defined in the API docs.
state (str) – The state code.
city (str) – The city in question.
- Returns:
A dictionary containing the zipcode of the given location.
- Return type:
dict