awesome-python icon indicating copy to clipboard operation
awesome-python copied to clipboard

Add IPinfo

Open abdullahdevrel opened this issue 1 year ago • 0 comments

What is this Python project?

This is the official IPinfo's Python library and provides IP to Geolocation data. The library is awesome because:

  • It provides easy access to IPinfo's API services such as IP to Geolocation data, ASN, privacy detection etc.
  • It even supports tokenless access to the API (1,000 req/month)
  • It supports bulk IP enrichment
  • Has native support for caching
  • Support async operation

Code example:

import ipinfo
handler = ipinfo.getHandler()
ip = "149.74.80.31"
details = handler.getDetails(ip)

print(details.all)

Output

{
  "ip": "149.74.80.31",
  "hostname": "31.pool149-74-80.dynamic.orange.es",
  "city": "Sant Mart\u00ed",
  "region": "Catalonia",
  "country": "ES",
  "loc": "41.4181,2.1993",
  "org": "AS12479 Orange Espagne SA",
  "postal": "08018",
  "timezone": "Europe/Madrid",
  "readme": "https://ipinfo.io/missingauth",
  "country_name": "Spain",
  "isEU": true,
  "country_flag_url": "https://cdn.ipinfo.io/static/images/countries-flags/ES.svg",
  "country_flag": {
    "emoji": "\ud83c\uddea\ud83c\uddf8",
    "unicode": "U+1F1EA U+1F1F8"
  },
  "country_currency": {
    "code": "EUR",
    "symbol": "\u20ac"
  },
  "continent": {
    "code": "EU",
    "name": "Europe"
  },
  "latitude": "41.4181",
  "longitude": "2.1993"
}

What's the difference between this Python project and similar ones?

As the library is officially built on top of IPinfo's API service, it is hard to distinguish this Python project from similar ones. However, there are additional advantages to using the library instead of accessing the API directly:

  • The library has built-in support for native bulk operations, allowing for efficient enrichment of IP metadata on a large scale without the need for sequential API calls.
  • The API does not provide country-specific information.
  • The library handles asynchronous operations internally.
  • Both Python and this library offer caching support, which is not available at the API level.

--

Anyone who agrees with this pull request could submit an Approve review to it.

abdullahdevrel avatar Jan 31 '24 12:01 abdullahdevrel