Skip to content

Commit eb9f726

Browse files
committed
p3 compatibility + some formatting + removing unused import
1 parent 5bbd5f5 commit eb9f726

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

overpass/api.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import requests
33
import json
4-
from shapely.geometry import mapping, Point
4+
from shapely.geometry import Point
55

66

77
class API(object):
@@ -44,7 +44,7 @@ def Get(self, query, asGeoJSON=False):
4444
response = json.loads(self._GetFromOverpass(
4545
self._ConstructQLQuery(query)))
4646
except OverpassException as oe:
47-
print oe
47+
print(oe)
4848
sys.exit(1)
4949

5050
if "elements" not in response or len(response["elements"]) == 0:
@@ -67,7 +67,7 @@ def _ConstructQLQuery(self, userquery):
6767

6868
complete_query = self._QUERY_TEMPLATE.format(responseformat=self.responseformat, query=raw_query)
6969
if self.debug:
70-
print complete_query
70+
print(complete_query)
7171
return complete_query
7272

7373
def _GetFromOverpass(self, query):
@@ -79,7 +79,7 @@ def _GetFromOverpass(self, query):
7979
try:
8080
r = requests.get(self.endpoint, params=payload, timeout=self.timeout)
8181
except requests.exceptions.Timeout:
82-
raise OverpassException(408,
82+
raise OverpassException(408,
8383
'Query timed out. API instance is set to time out in {timeout} seconds. '
8484
'Try passing in a higher value when instantiating this API:'
8585
'api = Overpass.API(timeout=60)'.format(timeout=self.timeout))
@@ -110,9 +110,11 @@ def _asGeoJSON(self, elements):
110110
print nodes
111111
print ways
112112

113+
113114
class OverpassException(Exception):
114115
def __init__(self, status_code, message):
115116
self.status_code = status_code
116117
self.message = message
118+
117119
def __str__(self):
118-
return json.dumps({'status': self.status_code, 'message': self.message})
120+
return json.dumps({'status': self.status_code, 'message': self.message})

0 commit comments

Comments
 (0)