-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major update with a few breaking changes. *MAJOR BREAKING CHANGE* - the `BearerAuth` class no longer exists. You can use a `BearerToken` directly as a `requests` auth handler instead. *MINOR BREAKING CHANGES* - parameter `url` to `ApiClient.request()`, `ApiClient.get()`, `ApiClient.post()`, etc. is now renamed to `path`. This doesn't matter as long as you use it as positional parameter (which was the case everywhere in the docs and tests and is usually the case when using `requests` directly). - renamed class `AccessToken` to `TokenResponse` (it was not used anywhere anyway) - rename `TokenEndpointPoolingJob` to `BaseTokenEndpointPoolingJob` - rename `ClientAssertionAuthenticationMethod` to `BaseClientAssertionAuthenticationMethod` - convert most classes to `attrs.frozen` classes. This should not create any regressions, but trying to modify attributes in instances of those classes will not work anymore. It was unsupported before anyway. - renamed `GrantType` enum to `GrantTypes` - reworked exceptions: * better error messages * added more context in exceptions * renamed `MismatchingAudience` to `MismatchingIdTokenAudience` * renamed `MismatchingAzp` to `MismatchingIdTokenAzp` * renamed `MismatchingNonce` to `MismatchingIdTokenNonce` * introduced `MismatchingIdTokenIssuer` * introduced many custom exceptions - renamed `PkceUtils.code_verifier_re` to `code_verifier_pattern` - `expires_at` is now rounded down to the exact second. - `expires_in` is now rounded up *OTHER CHANGES* - enable ALL ruff rules, implement fixes - improved tests mock `time.sleep` in tests - updated dependencies - improve test coverage to 100% - introduce `ResponseTypes` and move `CodeChallengeMethods` enums - introduce `Endpoints` enum - introduce `validate_bool_fields()` - reviewed and updated some docstrings - token_class can now be passed as parameter to `OAuth2Client` - added authorization header name as ClassVar in `BearerToken`, for #70
- Loading branch information
Showing
39 changed files
with
2,766 additions
and
1,737 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
*.* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool] | ||
[tool.poetry] | ||
name = "requests_oauth2client" | ||
version = "1.5.3" | ||
version = "1.6.0" | ||
homepage = "https://github.com/guillp/requests_oauth2client" | ||
description = "An OAuth2.x client based on `requests`." | ||
authors = ["Guillaume Pujol <[email protected]>"] | ||
|
@@ -35,8 +35,8 @@ attrs = ">=23.2.0" | |
|
||
|
||
[tool.poetry.dev-dependencies] | ||
coverage = ">=7.4" | ||
flask = ">=2.0.1" | ||
coverage = ">=7.6.1" | ||
flask = ">=3.0.3" | ||
livereload = ">=2.6.3" | ||
mypy = ">=1.8" | ||
mkdocs = ">=1.3.1" | ||
|
@@ -49,6 +49,7 @@ pre-commit = ">=3.5.0" | |
pytest = ">=7.0.1" | ||
pytest-cov = ">=3.0.0" | ||
pytest-freezer = ">=0.4.8" | ||
pytest-mock = "^3.14.0" | ||
pytest-mypy = ">=0.9.1" | ||
requests-mock = ">=1.9.3" | ||
toml = ">=0.10.2" | ||
|
@@ -60,12 +61,36 @@ virtualenv = ">=20.2.2" | |
|
||
[tool.poetry.extras] | ||
test = ["pytest", "pytest-cov"] | ||
doc = ["mdformat", "mkdocs", "mkdocs-autorefs", "mkdocs-include-markdown-plugin", "mkdocs-material", "mkdocs-material-extensions", "mkdocstrings"] | ||
doc = [ | ||
"mdformat", | ||
"mkdocs", | ||
"mkdocs-autorefs", | ||
"mkdocs-include-markdown-plugin", | ||
"mkdocs-material", | ||
"mkdocs-material-extensions", | ||
"mkdocstrings" | ||
] | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.coverage.run] | ||
source = ["requests_oauth2client"] | ||
|
||
[tool.coverage.report] | ||
exclude_also = [ | ||
"def __repr__", | ||
"if self.debug:", | ||
"if settings.DEBUG", | ||
"raise AssertionError", | ||
"raise NotImplementedError", | ||
"if 0:", | ||
"if __name__ == .__main__.:", | ||
"def main", | ||
"if TYPE_CHECKING:", | ||
] | ||
|
||
[tool.docformatter] | ||
black = true | ||
recursive = true | ||
|
@@ -76,58 +101,29 @@ blank = true | |
[tool.ruff] | ||
target-version = "py38" | ||
line-length = 120 | ||
extend-exclude = [ | ||
"tests" | ||
] | ||
|
||
|
||
[tool.ruff.format] | ||
docstring-code-format = true | ||
line-ending = "lf" | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
"A", | ||
"B", | ||
"C", | ||
"C4", | ||
"D", | ||
"DTZ", | ||
"E", | ||
"EM", | ||
"ERA", | ||
"F", | ||
"FA", | ||
"FBT", | ||
"I", | ||
"ICN", | ||
"ISC", | ||
"N", | ||
"PGH", | ||
"PLC", | ||
"PLE", | ||
"PLR", | ||
"PLW", | ||
"PTH", | ||
"Q", | ||
"RUF", | ||
"S", | ||
"SIM", | ||
"T", | ||
"TID", | ||
"TRY", | ||
"UP", | ||
"W", | ||
"YTT", | ||
] | ||
select = ["ALL"] | ||
ignore = [ | ||
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` | ||
"ANN401", # any-type in function args | ||
"N818", # Exception names should be named with an Error suffix | ||
"PLR0912", # Too many branches | ||
"D105", # Undocumented magic method | ||
"D107", # Missing docstring in `__init__` | ||
"S105", # Possible hardcoded password | ||
"ISC001", # single-line-implicit-string-concatenation | ||
"COM812", | ||
"ISC001", | ||
] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"tests/**.py" = ["ARG001", "B018", "D100", "D101", "D102", "D103", "D104", "F821", "PGH005", "PLR0913", "PLR0915", "PLR2004", "S101", "S106", "S113", | ||
"PT011", "E501"] | ||
|
||
[tool.ruff.lint.pylint] | ||
max-args = 10 | ||
|
||
|
@@ -137,7 +133,6 @@ ignore-decorators = ['override'] | |
|
||
[tool.mypy] | ||
strict = true | ||
implicit_reexport = true | ||
show_error_context = true | ||
show_column_numbers = true | ||
show_error_codes = true | ||
|
Oops, something went wrong.