Skip to content

Commit

Permalink
empty token
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerza committed Jun 6, 2023
1 parent a0c2d95 commit 7761e5c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ repos:
rev: v2.2.2
hooks:
- id: codespell
exclude: ^(.*comments_backup\.csv)$
# exclude: >-
# ^(.*comments_backup\.csv|.*poetry.lock)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp_msal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

_LOGGER = logging.getLogger(__name__)

VERSION = "0.5.4"
VERSION = "0.5.5"


def msal_session(*args: Callable[[AsyncMSAL], Union[Any, Awaitable[Any]]]) -> Callable:
Expand Down
5 changes: 4 additions & 1 deletion aiohttp_msal/msal_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ async def request(self, method: str, url: str, **kwargs: Any) -> ClientResponse:
AsyncMSAL._clientsession = ClientSession(trust_env=True)

token = await self.async_get_token()
if token is None:
raise web.HTTPClientError(text="No login token available.")

kwargs = kwargs.copy()
# Ensure headers exist & make a copy
kwargs["headers"] = headers = dict(kwargs.get("headers", {}))

headers["Authorization"] = "Bearer " + token["access_token"]

assert method in HTTP_ALLOWED, "Method must be one of the allowed ones"
if method not in HTTP_ALLOWED:
raise web.HTTPClientError(text=f"HTTP method {method} not allowed")

if method == HTTP_GET:
kwargs.setdefault("allow_redirects", True)
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ author_email = [email protected]
license = MIT
license_file = LICENSE
classifiers =
Development Status :: 2 - Pre-Alpha
Development Status :: 4 - Beta
Intended Audience :: Developers
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
keywords = msal, oauth, aiohttp, asyncio

[options]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""aiohttp_msal library setup."""
import setuptools
from setuptools import setup

if __name__ == "__main__":
setuptools.setup()
setup()

0 comments on commit 7761e5c

Please sign in to comment.