Navigate the globe with Python's webpage geolocation lookup.

Geolocation API use case.

Very often for SEO professionals it is required to check websites' geographical data for certain domain and there is a very useful online service for web developers and SEO professionals on "WhoisXML API" that provides Domain & IP Data Intelligence for Greater Enterprise Security and RESTful APIs that we will use.

Using it's APIs you can perform many handy data requests, for example you can Websites' geolocation lookup data for a certain website/domail or IP address - don't forget to get your API KEY. You will obtain with one API call ready to use parsed list of IP geolocation details, Latitude and Longitude, time zone offset by UTC, domain registrar details, ASN information, etc.

Website geolocation lookup.
Website geolocation lookup meme.

Python Knowledge Base: Make coding great again.
- Updated: 2024-07-23 by Andrey BRATUS, Senior Data Analyst.

    This Python script below will use information from "WhoisXML API" and provide you a result in a JSON format without the need to use a web browser.
    Getting websites' geolocation data can be easily automated now !

  1. Python code to get Website geolocation data via API:

    # Website IP Geolocation API USE
    import requests
    website = ''
    APIKEY ='at_ZUVkrukr4UHznQq2j6dyv2VhFGWYV'
    GeoInfoURL = f'{APIKEY}&domain={website}'
    r = requests.get(GeoInfoURL)
    GeoInfo = r.json()
    print(f'Geolocation Info for {website} domain.\n')

  3. Website geolocation data output:

    Geolocation Info for domain.
    {'ip': '',
     'location': {'country': 'RU',
      'region': 'Moskva',
      'city': 'Spas',
      'lat': 55.83333,
      'lng': 37.4,
      'postalCode': '',
      'timezone': '+03:00',
      'geonameId': 489871},
     'domains': ['',
     'as': {'asn': 197695,
      'name': 'AS-REGRU',
      'route': '',
      'domain': '',
      'type': ''},
     'isp': 'Domain names registrar REG.RU, Ltd',
     'connectionType': ''}

See also related topics: