From 97374e6e0ced208de1930174b3e79eca62775bdb Mon Sep 17 00:00:00 2001 From: donfaq Date: Mon, 11 Dec 2017 15:02:10 +0300 Subject: [PATCH] Requests proxy support --- overpass/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overpass/api.py b/overpass/api.py index 4a948e0ba9e..4f65bdeb8d2 100644 --- a/overpass/api.py +++ b/overpass/api.py @@ -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};" @@ -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: @@ -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'} )