From 7df7f6483a9540421a4b6670308872b0b99e20de Mon Sep 17 00:00:00 2001 From: Colin-b Date: Tue, 27 Apr 2021 22:02:00 +0200 Subject: [PATCH 1/2] Handle httpx 0.18 --- CHANGELOG.md | 7 ++++++- LICENSE | 2 +- httpx_auth/authentication.py | 4 ++-- httpx_auth/version.py | 2 +- setup.py | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d8d4a4..7e94f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.10.0] - 2021-04-27 +### Changed +- Requires [`httpx`](https://www.python-httpx.org)==0.18.\* + ## [0.9.0] - 2021-03-01 ### Changed - Requires [`httpx`](https://www.python-httpx.org)==0.17.\* @@ -99,7 +103,8 @@ Note that a few changes were made: ### Added - Placeholder for port of requests_auth to httpx -[Unreleased]: https://github.com/Colin-b/httpx_auth/compare/v0.9.0...HEAD +[Unreleased]: https://github.com/Colin-b/httpx_auth/compare/v0.10.0...HEAD +[0.10.0]: https://github.com/Colin-b/httpx_auth/compare/v0.9.0...v0.10.0 [0.9.0]: https://github.com/Colin-b/httpx_auth/compare/v0.8.0...v0.9.0 [0.8.0]: https://github.com/Colin-b/httpx_auth/compare/v0.7.0...v0.8.0 [0.7.0]: https://github.com/Colin-b/httpx_auth/compare/v0.6.0...v0.7.0 diff --git a/LICENSE b/LICENSE index 17be259..b70e7e0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Colin Bounouar +Copyright (c) 2021 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/httpx_auth/authentication.py b/httpx_auth/authentication.py index d764fc9..8f027d3 100644 --- a/httpx_auth/authentication.py +++ b/httpx_auth/authentication.py @@ -1152,8 +1152,8 @@ def __init__(self, api_key: str, query_parameter_name: str = None): def auth_flow( self, request: httpx.Request ) -> Generator[httpx.Request, httpx.Response, None]: - request.url = httpx.URL( - request.url, params={self.query_parameter_name: self.api_key} + request.url = request.url.copy_merge_params( + {self.query_parameter_name: self.api_key} ) yield request diff --git a/httpx_auth/version.py b/httpx_auth/version.py index 97e9e7a..cee5ccd 100644 --- a/httpx_auth/version.py +++ b/httpx_auth/version.py @@ -3,4 +3,4 @@ # Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0) # Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0) # Patch should be incremented in case there is a bug fix. (eg: 2.5.8 -> 2.5.9) -__version__ = "0.9.0" +__version__ = "0.10.0" diff --git a/setup.py b/setup.py index 6a06c86..184ff19 100644 --- a/setup.py +++ b/setup.py @@ -36,14 +36,14 @@ packages=find_packages(exclude=["tests*"]), install_requires=[ # Used for Base Authentication and to communicate with OAuth2 servers - "httpx==0.17.*" + "httpx==0.18.*" ], extras_require={ "testing": [ # Used to generate test tokens "pyjwt==1.*", # Used to mock httpx - "pytest_httpx==0.11.*", + "pytest_httpx==0.12.*", # Used to check coverage "pytest-cov==2.*", ] From 1d7351693f60699e2bc9a526191da76e1095fb0e Mon Sep 17 00:00:00 2001 From: Colin-b Date: Tue, 27 Apr 2021 22:19:39 +0200 Subject: [PATCH 2/2] Ensure code_verifier is sent the way it was previously sent --- httpx_auth/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpx_auth/authentication.py b/httpx_auth/authentication.py index 8f027d3..3b428d4 100644 --- a/httpx_auth/authentication.py +++ b/httpx_auth/authentication.py @@ -565,7 +565,7 @@ def __init__(self, authorization_url: str, token_url: str, **kwargs): # As described in https://tools.ietf.org/html/rfc6749#section-4.1.3 # include the PKCE code verifier used in the second part of the flow self.token_data = { - "code_verifier": code_verifier, + "code_verifier": code_verifier.decode("ascii"), "grant_type": "authorization_code", "redirect_uri": self.redirect_uri, }