File tree Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -8,25 +8,14 @@ class API(object):
88 # defaults for the API class
99 TIMEOUT = 25 # seconds
1010 ENDPOINT = "http://overpass-api.de/api/interpreter"
11+ RESPONSE_FORMAT = "json"
1112 DEBUG = False
1213
13- def __init__ (self ,
14- endpoint = None ,
15- timeout = None ,
16- debug = None
17- ):
18- if endpoint is None :
19- self .endpoint = self .ENDPOINT
20- else :
21- self .endpoint = endpoint
22- if timeout is None :
23- self .timeout = self .TIMEOUT
24- else :
25- self .timeout = timeout
26- if debug is None :
27- self .debug = self .DEBUG
28- else :
29- self .debug = debug
14+ def __init__ (self , * args , ** kwargs ):
15+ self .endpoint = kwargs .get ("endpoint" , self .ENDPOINT )
16+ self .timeout = kwargs .get ("timeout" , self .TIMEOUT )
17+ self .debug = kwargs .get ("debug" , self .DEBUG )
18+ self .response_format = kwargs .get ("response_format" , self .RESPONSE_FORMAT )
3019 self ._status = None
3120
3221 if self .debug :
@@ -64,7 +53,7 @@ def _ConstructError(self, msg):
6453
6554 def _ConstructQLQuery (self , userquery ):
6655 if self .debug :
67- print "[out:json ];" + userquery + "out body;"
56+ print "[out:{response_format} ];" . format ( response_format = self . response_format ) + userquery + "out body;"
6857 if not userquery .endswith (";" ):
6958 userquery += ";"
7059 return "[out:json];" + userquery + "out body;"
You can’t perform that action at this time.
0 commit comments