Skip to content

Commit

Permalink
Merge pull request mvexel#110 from alltrails/master
Browse files Browse the repository at this point in the history
 Added ability to set headers of request
  • Loading branch information
mvexel authored Dec 21, 2018
2 parents 7e31edc + 325def8 commit 4eea382
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion overpass/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class API(object):
# defaults for the API class
_timeout = 25 # second
_endpoint = "https://overpass-api.de/api/interpreter"
_headers = {"Accept-Charset": "utf-8;q=0.7,*;q=0.7"}
_debug = False
_proxies = None

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

def __init__(self, *args, **kwargs):
self.endpoint = kwargs.get("endpoint", self._endpoint)
self.headers = kwargs.get("headers", self._headers)
self.timeout = kwargs.get("timeout", self._timeout)
self.debug = kwargs.get("debug", self._debug)
self.proxies = kwargs.get("proxies", self._proxies)
Expand Down Expand Up @@ -141,7 +143,7 @@ def _get_from_overpass(self, query):
data=payload,
timeout=self.timeout,
proxies=self.proxies,
headers={"Accept-Charset": "utf-8;q=0.7,*;q=0.7"},
headers=self.headers,
)

except requests.exceptions.Timeout:
Expand Down

0 comments on commit 4eea382

Please sign in to comment.