|
18 | 18 | from prometheus_client import Gauge |
19 | 19 |
|
20 | 20 | from tornado import gen |
21 | | -from tornado.httpclient import AsyncHTTPClient, HTTPError, HTTPRequest |
| 21 | +from tornado.httpclient import HTTPError, HTTPRequest |
22 | 22 | from tornado.httputil import url_concat |
23 | 23 |
|
24 | 24 | from traitlets import Dict, Unicode, Bool, default, List, observe |
25 | 25 | from traitlets.config import LoggingConfigurable |
26 | 26 |
|
27 | 27 | from .utils import Cache |
| 28 | +from .utils import ProxiedAsyncHTTPClient |
28 | 29 |
|
29 | 30 | GITHUB_RATE_LIMIT = Gauge('binderhub_github_rate_limit_remaining', 'GitHub rate limit remaining') |
30 | 31 | SHA1_PATTERN = re.compile(r'[0-9a-f]{40}') |
@@ -217,7 +218,7 @@ class ZenodoProvider(RepoProvider): |
217 | 218 |
|
218 | 219 | @gen.coroutine |
219 | 220 | def get_resolved_ref(self): |
220 | | - client = AsyncHTTPClient() |
| 221 | + client = ProxiedAsyncHTTPClient() |
221 | 222 | req = HTTPRequest("https://doi.org/{}".format(self.spec), |
222 | 223 | user_agent="BinderHub") |
223 | 224 | r = yield client.fetch(req) |
@@ -257,7 +258,7 @@ class FigshareProvider(RepoProvider): |
257 | 258 |
|
258 | 259 | @gen.coroutine |
259 | 260 | def get_resolved_ref(self): |
260 | | - client = AsyncHTTPClient() |
| 261 | + client = ProxiedAsyncHTTPClient() |
261 | 262 | req = HTTPRequest("https://doi.org/{}".format(self.spec), |
262 | 263 | user_agent="BinderHub") |
263 | 264 | r = yield client.fetch(req) |
@@ -439,7 +440,7 @@ def get_resolved_ref(self): |
439 | 440 | return self.resolved_ref |
440 | 441 |
|
441 | 442 | namespace = urllib.parse.quote(self.namespace, safe='') |
442 | | - client = AsyncHTTPClient() |
| 443 | + client = ProxiedAsyncHTTPClient() |
443 | 444 | api_url = "https://{hostname}/api/v4/projects/{namespace}/repository/commits/{ref}".format( |
444 | 445 | hostname=self.hostname, |
445 | 446 | namespace=namespace, |
@@ -582,7 +583,7 @@ async def get_resolved_ref_url(self): |
582 | 583 |
|
583 | 584 | @gen.coroutine |
584 | 585 | def github_api_request(self, api_url, etag=None): |
585 | | - client = AsyncHTTPClient() |
| 586 | + client = ProxiedAsyncHTTPClient() |
586 | 587 | if self.auth: |
587 | 588 | # Add auth params. After logging! |
588 | 589 | api_url = url_concat(api_url, self.auth) |
|
0 commit comments