Skip to main content

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.5

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.5
File Size Uploaded
ipdata-2.5.tar.gz 2.0 kB Details

Release files / ipdata-2.5.tar.gz

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

Release history Release notifications | RSS feed

4.0.9

2 release files

4.0.8

2 release files

4.0.7

2 release files

4.0.6

2 release files

4.0.5

2 release files

4.0.4

2 release files

4.0.3

2 release files

4.0.0

2 release files

3.4.6

2 release files

3.4.4

2 release files

3.4.3

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.9

2 release files

3.3.8

2 release files

3.3.6

2 release files

3.3.1

2 release files

3.2

1 release file

3.1

1 release file

3.0

1 release file

2.8

1 release file

2.6

1 release file

This release

2.5 This release

1 release file

2.4

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.9

1 release file

1.8

1 release file

1.7

1 release file

1.6

1 release file

1.5

1 release file

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