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'])

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipdata-2.6.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file ipdata-2.6.tar.gz.

File metadata

  • Download URL: ipdata-2.6.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ipdata-2.6.tar.gz
Algorithm Hash digest
SHA256 94206afef6e868b709ad4a9ac20de8de9b2c010fb88bde0bba5b69c412e95d7f
MD5 8634b832c388023bcbf36c6063864497
BLAKE2b-256 cce1597ccf10d0e98522452ab736d9892b514b2e379c572704abc8eb240f2c5d

See more details on using hashes here.

Release history Release notifications | RSS feed

4.0.9

2 files

4.0.8

2 files

4.0.7

2 files

4.0.6

2 files

4.0.5

2 files

4.0.4

2 files

4.0.3

2 files

4.0.0

2 files

3.4.6

2 files

3.4.4

2 files

3.4.3

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.9

2 files

3.3.8

2 files

3.3.6

2 files

3.3.1

2 files

3.2

1 file

3.1

1 file

3.0

1 file

2.8

1 file

This release

2.6 This release

1 file

2.5

1 file

2.4

1 file

2.3

1 file

2.2

1 file

2.1

1 file

2.0

1 file

1.9

1 file

1.8

1 file

1.7

1 file

1.6

1 file

1.5

1 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