-
Notifications
You must be signed in to change notification settings - Fork 95
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
feat(auth): implement iap auth token #637
Changes from 8 commits
9ef32ac
3786764
bcabef3
2a77ecf
850a90c
893030c
3e5a225
8cfc9a9
fc5d958
e7aa915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,14 @@ async def delete( | |
) -> Response: | ||
pass | ||
|
||
@abstractmethod | ||
async def head( | ||
self, url: str, headers: Optional[Mapping[str, str]], | ||
timeout: float, params: Optional[Mapping[str, Union[int, str]]], | ||
allow_redirects: bool, | ||
) -> Response: | ||
pass | ||
|
||
@abstractmethod | ||
async def request( | ||
self, method: str, url: str, headers: Mapping[str, str], | ||
|
@@ -219,6 +227,21 @@ async def delete( # type: ignore[override] | |
await _raise_for_status(resp) | ||
return resp | ||
|
||
async def head( # type: ignore[override] | ||
self, url: str, | ||
headers: Optional[Mapping[str, str]] = None, | ||
timeout: Timeout = 10, | ||
params: Optional[Mapping[str, Union[int, str]]] = None, | ||
allow_redirects: bool = False, | ||
) -> aiohttp.ClientResponse: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is imported as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the previous comment about wanting to avoid changing unrelated parts of the code. @TheKevJames might be able to tell you more about this choice. |
||
resp = await self.session.head( | ||
url, headers=headers, | ||
params=params, timeout=timeout, | ||
allow_redirects=allow_redirects, | ||
) | ||
await _raise_for_status(resp) | ||
return resp | ||
|
||
async def request( # type: ignore[override] | ||
self, method: str, | ||
url: str, headers: Mapping[str, str], | ||
|
@@ -321,6 +344,20 @@ async def delete( | |
resp.raise_for_status() | ||
return resp | ||
|
||
async def head( | ||
self, url: str, headers: Optional[Mapping[str, str]] = None, | ||
timeout: float = 10, | ||
params: Optional[Mapping[str, Union[int, str]]] = None, | ||
allow_redirects: bool = False, | ||
) -> Response: | ||
with self.google_api_lock: | ||
resp = self.session.head( | ||
url, params=params, headers=headers, | ||
timeout=timeout, allow_redirects=allow_redirects, | ||
) | ||
resp.raise_for_status() | ||
return resp | ||
|
||
async def request( | ||
self, method: str, url: str, headers: Mapping[str, str], | ||
auto_raise_for_status: bool = True, **kwargs: Any, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps https://docs.python.org/3/library/exceptions.html#NotImplementedError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could definitely work, although I would like to limit the sprawl of my changes and this is an extension of existing form. Since this is an abstract base class and this is an abstract method, you can't instantiate an object of this class so raising is redundant: