Skip to content
Snippets Groups Projects
Commit f4aa5092 authored by Jeremy Kersten's avatar Jeremy Kersten
Browse files

[FIX] base_geolocalize: use urllib2 to make request

For an unknown reason, in some case, urllib doesn't work while with urllib2 it works.
Since we don't have the opposite case until now (work in urllib and not urllib2), we
considere that it fixes the issue.

this commit closes #14636
parent f0c34f0d
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ try:
import simplejson as json
except ImportError:
import json # noqa
import urllib
import urllib2
from openerp.osv import osv, fields
from openerp import tools
......@@ -32,10 +32,10 @@ from openerp.tools.translate import _
def geo_find(addr):
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
url += urllib.quote(addr.encode('utf8'))
url += urllib2.quote(addr.encode('utf8'))
try:
result = json.load(urllib.urlopen(url))
result = json.load(urllib2.urlopen(url))
except Exception, e:
raise osv.except_osv(_('Network error'),
_('Cannot contact geolocation servers. Please make sure that your internet connection is up and running (%s).') % e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment