Skip to content

Instantly share code, notes, and snippets.

@ppa-odoo
Last active January 30, 2023 06:56
Show Gist options
  • Save ppa-odoo/e7a45697cb87e5d34e3027f53fd5d56e to your computer and use it in GitHub Desktop.
Save ppa-odoo/e7a45697cb87e5d34e3027f53fd5d56e to your computer and use it in GitHub Desktop.
GeoIP Configuration
sudo add-apt-repository ppa:maxmind/ppa
sudo apt update
sudo apt install libgeoip1 libgeoip-dev geoip-bin
sudo pip3 install GeoIP # For Python 3
sudo apt-get install geoip-database-contrib
==================================================
import GeoIP
geofile = config.get('geoip_database')
gio_data = GeoIP.open(geofile, GeoIP.GEOIP_STANDARD).record_by_addr(ip)
return gio_data
Database Update : geoip-database-contrib_update
-----------------------------------------------------------------------------------------------
import urllib
import json
import GeoIP
from odoo.tools import config
import os
geofile = config.get('geoip_database')
gio_data = GeoIP.open(geofile, GeoIP.GEOIP_STANDARD).record_by_addr('127.0.0.1')
================================================================================
https://www.whatismyip.com/what-is-my-public-ip-address/
https://github.com/odoo/iap-apps/blob/master-reveal-iap-dep/reveal_service/controllers/main.py
https://packages.ubuntu.com/trusty/geoip-database-contrib
https://github.com/maxmind/geoip-api-python/issues/20
https://pypi.python.org/pypi/geoip2
https://github.com/maxmind/geoip-api-python
https://github.com/Xifax/goip-sms-bank/blob/master/manage.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment