This repository was archived by the owner on May 19, 2025. It is now read-only.
File tree 1 file changed +7
-18
lines changed 1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -8,25 +8,14 @@ class API(object):
8
8
# defaults for the API class
9
9
TIMEOUT = 25 # seconds
10
10
ENDPOINT = "http://overpass-api.de/api/interpreter"
11
+ RESPONSE_FORMAT = "json"
11
12
DEBUG = False
12
13
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 )
30
19
self ._status = None
31
20
32
21
if self .debug :
@@ -64,7 +53,7 @@ def _ConstructError(self, msg):
64
53
65
54
def _ConstructQLQuery (self , userquery ):
66
55
if self .debug :
67
- print "[out:json ];" + userquery + "out body;"
56
+ print "[out:{response_format} ];" . format ( response_format = self . response_format ) + userquery + "out body;"
68
57
if not userquery .endswith (";" ):
69
58
userquery += ";"
70
59
return "[out:json];" + userquery + "out body;"
You can’t perform that action at this time.
0 commit comments