Skip to main content

Getting Started

This repo provides a Python client for the ipdata.co Free Geolocation API.

Installation

Run

pip install ipdata

Examples

from ipdata import ipdata
ip = ipdata.ipdata()
data = ip.lookup('1.1.1.1')
if data['status']==200:
    for key in data['response']:
        print('#', key, ':', data['response'][key])
else:
    print(data['response'])
# ip : 1.1.1.1
# city : Research
# region : Victoria
# country_name : Australia
# country_code : AU
# continent_name : Oceania
# continent_code : OC
# latitude : -37.7
# longitude : 145.1833
# asn :
# organisation :
# postal : 3095
# currency : AUD
# currency_symbol : $
# calling_code : 61
# flag : https://ipdata.co/flags/au.png
# time_zone : Australia/Melbourne

To get a specific field, do

country = ip.lookup('1.1.1.1')['response']['country_name']
# 'Australia'

Using API keys

from ipdata import ipdata

apikey = 'myapikey'
ip = ipdata.ipdata(apikey=apikey)
data = ip.lookup('1.1.1.1')

if data['status']==200:
    for key in data['response']:
        print('#', key, ':', data['response'][key])
else:
    print(data['response'])

Metadata

Release files for ipdata 2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipdata 2.3
File Size Uploaded Provenance Actions
ipdata-2.3.tar.gz 2.0 kB Without provenance Details for ipdata-2.3.tar.gz

Release files / ipdata-2.3.tar.gz

Download URL ipdata-2.3.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7221cbed094de38a5cf540c3eca2bc370ee16328d0a1b555dc200eda2021d7c0
BLAKE2b-256 checksum
How to use checksums
f7b3fd05e03787893cd890a56df6ce65f7ad77d925b6e7eea7e745c40c277f6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ipdata 2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page