Modernize Python 2 code to get ready for Python 3

This commit is contained in:
cclauss
2018-12-02 09:41:29 +01:00
parent c597191892
commit 7c47cd7d0c
7 changed files with 25 additions and 19 deletions

View File

@ -7,6 +7,7 @@ and basing on this information generates
precise location description.
"""
from __future__ import print_function
import os
import json
@ -67,7 +68,7 @@ def geolocator(location):
try:
geo = requests.get('%s/%s' % (GEOLOCATOR_SERVICE, location)).text
except requests.exceptions.ConnectionError as exception:
print "ERROR: %s" % exception
print("ERROR: %s" % exception)
return None
if geo == "":
@ -77,7 +78,7 @@ def geolocator(location):
answer = json.loads(geo.encode('utf-8'))
return answer
except ValueError as exception:
print "ERROR: %s" % exception
print("ERROR: %s" % exception)
return None
return None