mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-12 15:07:10 +02:00
Modernize Python 2 code to get ready for Python 3
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user