GithubHelp home page GithubHelp logo

freegeoip's Introduction

FREE GEOIP SERVICE

Get free geoip data for requests for client requests.

This works thanks to some special headers added by Google App engine to each request that it serves.

For this reason, this can only be deployed on App engine.

App engine only returns some basic info like: latitude, longitude, city, country but if this is enough then you can get all this for free.

About

This is a simple Flask app that reads the special headers that Google App engine adds to each request and returns them as JSON.

Note: This only works for requests that come directly from the client's device (no way to request for a specific IP).

App engine has a decent free tier so this service can be run for free.

Example response:

{
    "city":"bucharest",
    "countryCode":"RO",
    "ipAddress":"xx.xxx.xxx.xx",
    "latitude":"44.426767",
    "longitude":"26.102538",
    "regionCode":"b"
}

Demo

Try it for free at https://free-geoip.ey.r.appspot.com/

How to deploy

  1. Pull repo
git clone https://github.com/onel/freegeoip .
cd freegeoip
  1. Create a new project in Google cloud console and an App engine app.

  2. Setup local configurations for this new project

gcloud config configurations create [project_id]
gcloud config set project [project_id]
gcloud auth login
gcloud app deploy . --version 1
  1. Make requests to that endpoint to get getip info
const url = '[your freegeoip endpoint]'
fetch(url)
    .then(response => response.json())
    .then(data => {
        console.log('JSON data:', data);
    })
    .catch(error => {
        console.error('Fetch error:', error);
    })

Stack

Python 3.9

Flask

Licence

MIT

freegeoip's People

Contributors

onel avatar

Stargazers

anton avatar  avatar John Balladares avatar  avatar Billy Lo avatar Aayushman Choudhary avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.