Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests proxy support #86

Merged
merged 1 commit into from
Apr 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions overpass/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class API(object):
_timeout = 25 # second
_endpoint = "https://overpass-api.de/api/interpreter"
_debug = False
_proxies = None

_QUERY_TEMPLATE = "[out:{out}];{query}out {verbosity};"
_GEOJSON_QUERY_TEMPLATE = "[out:json];{query}out {verbosity};"
Expand All @@ -24,6 +25,7 @@ def __init__(self, *args, **kwargs):
self.endpoint = kwargs.get("endpoint", self._endpoint)
self.timeout = kwargs.get("timeout", self._timeout)
self.debug = kwargs.get("debug", self._debug)
self.proxies = kwargs.get("proxies", self._proxies)
self._status = None

if self.debug:
Expand Down Expand Up @@ -121,6 +123,7 @@ def _GetFromOverpass(self, query):
self.endpoint,
data=payload,
timeout=self.timeout,
proxies=self.proxies,
headers={'Accept-Charset': 'utf-8;q=0.7,*;q=0.7'}
)

Expand Down