Skip to content

Commit 4eea382

Browse files
authored
Merge pull request mvexel#110 from alltrails/master
Added ability to set headers of request
2 parents 7e31edc + 325def8 commit 4eea382

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

overpass/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class API(object):
2727
# defaults for the API class
2828
_timeout = 25 # second
2929
_endpoint = "https://overpass-api.de/api/interpreter"
30+
_headers = {"Accept-Charset": "utf-8;q=0.7,*;q=0.7"}
3031
_debug = False
3132
_proxies = None
3233

@@ -35,6 +36,7 @@ class API(object):
3536

3637
def __init__(self, *args, **kwargs):
3738
self.endpoint = kwargs.get("endpoint", self._endpoint)
39+
self.headers = kwargs.get("headers", self._headers)
3840
self.timeout = kwargs.get("timeout", self._timeout)
3941
self.debug = kwargs.get("debug", self._debug)
4042
self.proxies = kwargs.get("proxies", self._proxies)
@@ -141,7 +143,7 @@ def _get_from_overpass(self, query):
141143
data=payload,
142144
timeout=self.timeout,
143145
proxies=self.proxies,
144-
headers={"Accept-Charset": "utf-8;q=0.7,*;q=0.7"},
146+
headers=self.headers,
145147
)
146148

147149
except requests.exceptions.Timeout:

0 commit comments

Comments
 (0)