abderrahim commented on code in PR #59:
URL:
https://github.com/apache/buildstream-plugins/pull/59#discussion_r1372862695
##########
src/buildstream_plugins/sources/docker.py:
##########
@@ -121,6 +121,26 @@ def urljoin(url, *args):
return url
+# Handles authentication with a bearer token
+class BearerAuth(requests.auth.AuthBase):
+ def __init__(self, api_timeout=3):
+ self.token = None
+ self.api_timeout = api_timeout
+
+ def __call__(self, r):
+ if self.token:
+ r.headers["Authorization"] = "Bearer {}".format(self.token)
+ return r
+
+ def _auth(self, realm, service, scope):
Review Comment:
Ack, I had moved the function as-is. I changed it a bit now and renamed it.
Let me know what you think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]