dapla-auth-client 1.2.2__tar.gz → 1.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dapla_auth_client-1.2.5/.gitignore +147 -0
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/PKG-INFO +18 -24
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/README.md +3 -3
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/pyproject.toml +72 -46
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/src/dapla_auth_client/auth.py +10 -6
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/LICENSE +0 -0
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/src/dapla_auth_client/__init__.py +0 -0
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/src/dapla_auth_client/const.py +0 -0
- {dapla_auth_client-1.2.2 → dapla_auth_client-1.2.5}/src/dapla_auth_client/py.typed +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# PyCharm
|
|
132
|
+
.idea/
|
|
133
|
+
|
|
134
|
+
/.python-version
|
|
135
|
+
/.pytype/
|
|
136
|
+
/docs/_build/
|
|
137
|
+
|
|
138
|
+
# Visual Studio Code
|
|
139
|
+
.vscode/*
|
|
140
|
+
# Local History for Visual Studio Code
|
|
141
|
+
.history/
|
|
142
|
+
# Built Visual Studio Code Extensions
|
|
143
|
+
*.vsix
|
|
144
|
+
|
|
145
|
+
# direnv
|
|
146
|
+
.direnv/
|
|
147
|
+
.envrc
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dapla-auth-client
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: Dapla Auth Client
|
|
5
|
-
License: MIT
|
|
6
|
-
Author: Dapla Developers
|
|
7
|
-
Author-email: dapla-platform-developers@ssb.no
|
|
8
|
-
Requires-Python: >=3.11
|
|
9
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Requires-Dist: deprecated (>=1.2.18)
|
|
16
|
-
Requires-Dist: google-auth (>=2.40.2)
|
|
17
|
-
Requires-Dist: requests (>=2.27.1)
|
|
18
|
-
Requires-Dist: responses (>=0.24.0)
|
|
19
|
-
Requires-Dist: types-deprecated (>=1.2.15.20250304)
|
|
20
|
-
Requires-Dist: types-requests (>=2.28.11)
|
|
21
|
-
Project-URL: Changelog, https://github.com/statisticsnorway/dapla-auth-client/releases
|
|
22
|
-
Project-URL: Documentation, https://statisticsnorway.github.io/dapla-auth-client
|
|
23
5
|
Project-URL: Homepage, https://github.com/statisticsnorway/dapla-auth-client
|
|
24
6
|
Project-URL: Repository, https://github.com/statisticsnorway/dapla-auth-client
|
|
7
|
+
Project-URL: Documentation, https://statisticsnorway.github.io/dapla-auth-client
|
|
8
|
+
Project-URL: Changelog, https://github.com/statisticsnorway/dapla-auth-client/releases
|
|
9
|
+
Author-email: Dapla Developers <dapla-platform-developers@ssb.no>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: deprecated>=1.2.18
|
|
15
|
+
Requires-Dist: google-auth>=2.40.2
|
|
16
|
+
Requires-Dist: requests>=2.27.1
|
|
17
|
+
Requires-Dist: responses>=0.24.0
|
|
18
|
+
Requires-Dist: types-deprecated>=1.2.15.20250304
|
|
19
|
+
Requires-Dist: types-requests>=2.28.11
|
|
25
20
|
Description-Content-Type: text/markdown
|
|
26
21
|
|
|
27
22
|
# Dapla Auth Client
|
|
@@ -39,7 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
39
34
|
[][pre-commit]
|
|
40
35
|
[][black]
|
|
41
36
|
[](https://github.com/astral-sh/ruff)
|
|
42
|
-
[][uv]
|
|
43
38
|
|
|
44
39
|
[pypi status]: https://pypi.org/project/dapla-auth-client/
|
|
45
40
|
[documentation]: https://statisticsnorway.github.io/dapla-auth-client
|
|
@@ -48,7 +43,7 @@ Description-Content-Type: text/markdown
|
|
|
48
43
|
[sonarquality]: https://sonarcloud.io/summary/overall?id=statisticsnorway_dapla-auth-client
|
|
49
44
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
50
45
|
[black]: https://github.com/psf/black
|
|
51
|
-
[
|
|
46
|
+
[uv]: https://docs.astral.sh/uv/
|
|
52
47
|
|
|
53
48
|
## Features
|
|
54
49
|
|
|
@@ -62,7 +57,7 @@ Description-Content-Type: text/markdown
|
|
|
62
57
|
## Requirements
|
|
63
58
|
|
|
64
59
|
- Python >3.8 (3.10 is preferred)
|
|
65
|
-
-
|
|
60
|
+
- uv, install via `curl -LsSf https://astral.sh/uv/install.sh | sh`
|
|
66
61
|
|
|
67
62
|
## Installation
|
|
68
63
|
|
|
@@ -112,4 +107,3 @@ This project was generated from [Statistics Norway]'s [SSB PyPI Template].
|
|
|
112
107
|
[license]: https://github.com/statisticsnorway/dapla-auth-client/blob/main/LICENSE
|
|
113
108
|
[contributor guide]: https://github.com/statisticsnorway/dapla-auth-client/blob/main/CONTRIBUTING.md
|
|
114
109
|
[reference guide]: https://statisticsnorway.github.io/dapla-auth-client/reference.html
|
|
115
|
-
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
[][pre-commit]
|
|
14
14
|
[][black]
|
|
15
15
|
[](https://github.com/astral-sh/ruff)
|
|
16
|
-
[][uv]
|
|
17
17
|
|
|
18
18
|
[pypi status]: https://pypi.org/project/dapla-auth-client/
|
|
19
19
|
[documentation]: https://statisticsnorway.github.io/dapla-auth-client
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
[sonarquality]: https://sonarcloud.io/summary/overall?id=statisticsnorway_dapla-auth-client
|
|
23
23
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
24
24
|
[black]: https://github.com/psf/black
|
|
25
|
-
[
|
|
25
|
+
[uv]: https://docs.astral.sh/uv/
|
|
26
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
## Requirements
|
|
37
37
|
|
|
38
38
|
- Python >3.8 (3.10 is preferred)
|
|
39
|
-
-
|
|
39
|
+
- uv, install via `curl -LsSf https://astral.sh/uv/install.sh | sh`
|
|
40
40
|
|
|
41
41
|
## Installation
|
|
42
42
|
|
|
@@ -1,55 +1,75 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "dapla-auth-client"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.5"
|
|
4
4
|
description = "Dapla Auth Client"
|
|
5
|
-
authors = ["Dapla Developers
|
|
6
|
-
|
|
5
|
+
authors = [{ name = "Dapla Developers", email = "dapla-platform-developers@ssb.no" }]
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
|
|
9
|
-
repository = "https://github.com/statisticsnorway/dapla-auth-client"
|
|
10
|
-
documentation = "https://statisticsnorway.github.io/dapla-auth-client"
|
|
8
|
+
license = "MIT"
|
|
11
9
|
classifiers = ["Development Status :: 5 - Production/Stable"]
|
|
12
|
-
|
|
10
|
+
dependencies = [
|
|
11
|
+
"requests>=2.27.1",
|
|
12
|
+
"google-auth>=2.40.2",
|
|
13
|
+
"deprecated>=1.2.18",
|
|
14
|
+
"types-requests>=2.28.11",
|
|
15
|
+
"responses>=0.24.0",
|
|
16
|
+
"types-deprecated>=1.2.15.20250304",
|
|
17
|
+
]
|
|
13
18
|
|
|
14
|
-
[
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/statisticsnorway/dapla-auth-client"
|
|
21
|
+
Repository = "https://github.com/statisticsnorway/dapla-auth-client"
|
|
22
|
+
Documentation = "https://statisticsnorway.github.io/dapla-auth-client"
|
|
15
23
|
Changelog = "https://github.com/statisticsnorway/dapla-auth-client/releases"
|
|
16
24
|
|
|
17
|
-
[
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
[project.scripts]
|
|
26
|
+
dapla-auth-client = "dapla_auth_client.__main__:main"
|
|
27
|
+
|
|
28
|
+
[dependency-groups]
|
|
29
|
+
lint = [
|
|
30
|
+
"black[jupyter]>=25.11.0",
|
|
31
|
+
"pre-commit>=4.4.0",
|
|
32
|
+
"pre-commit-hooks>=6.0.0",
|
|
33
|
+
"pydoclint>=0.8.3",
|
|
34
|
+
"ruff>=0.14.5",
|
|
35
|
+
]
|
|
36
|
+
doc = [
|
|
37
|
+
"furo>=2025.9.25; python_version >= '3.11'",
|
|
38
|
+
"myst-parser>=4.0.1; python_version >= '3.11'",
|
|
39
|
+
"sphinx>=8.2.3; python_version >= '3.11'",
|
|
40
|
+
"sphinx-autobuild>=2025.8.25; python_version >= '3.11'",
|
|
41
|
+
"sphinx-autodoc-typehints>=3.5.2; python_version >= '3.11'",
|
|
42
|
+
"sphinx-click>=6.1.0; python_version >= '3.11'",
|
|
43
|
+
]
|
|
44
|
+
dev = [
|
|
45
|
+
"pygments>=2.10.0",
|
|
46
|
+
{include-group = "lint"},
|
|
47
|
+
{include-group = "doc"},
|
|
48
|
+
"coverage[toml]>=7.11.3",
|
|
49
|
+
"deptry>=0.24.0; python_version >= '3.10' and python_version < '4.0'",
|
|
50
|
+
"mypy>=1.18.2",
|
|
51
|
+
"pygments>=2.19.0",
|
|
52
|
+
"pytest>=9.0.0",
|
|
53
|
+
"typeguard>=2.13.3",
|
|
54
|
+
"xdoctest[colors]>=1.3.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.hatch.build.targets.sdist]
|
|
58
|
+
include = ["src/dapla_auth_client"]
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build.targets.wheel]
|
|
61
|
+
include = ["src/dapla_auth_client"]
|
|
62
|
+
|
|
63
|
+
[tool.hatch.build.targets.wheel.sources]
|
|
64
|
+
"src/dapla_auth_client" = "dapla_auth_client"
|
|
65
|
+
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["hatchling"]
|
|
68
|
+
build-backend = "hatchling.build"
|
|
46
69
|
|
|
47
70
|
[tool.pytest.ini_options]
|
|
48
71
|
pythonpath = ["src"]
|
|
49
72
|
|
|
50
|
-
[tool.poetry.scripts]
|
|
51
|
-
dapla-auth-client = "dapla_auth_client.__main__:main"
|
|
52
|
-
|
|
53
73
|
[tool.coverage.paths]
|
|
54
74
|
source = ["src", "*/site-packages"]
|
|
55
75
|
tests = ["tests", "*/tests"]
|
|
@@ -74,7 +94,7 @@ show_error_context = true
|
|
|
74
94
|
force-exclude = true # Apply excludes to pre-commit
|
|
75
95
|
show-fixes = true
|
|
76
96
|
src = ["src", "tests"]
|
|
77
|
-
target-version = "
|
|
97
|
+
target-version = "py310" # Minimum Python version supported
|
|
78
98
|
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
|
|
79
99
|
extend-exclude = [
|
|
80
100
|
"__pycache__",
|
|
@@ -83,6 +103,7 @@ extend-exclude = [
|
|
|
83
103
|
"noxfile.py",
|
|
84
104
|
"docs/conf.py",
|
|
85
105
|
]
|
|
106
|
+
external = ["DOC"]
|
|
86
107
|
|
|
87
108
|
# Ruff rules may be customized as desired: https://docs.astral.sh/ruff/rules/
|
|
88
109
|
[tool.ruff.lint]
|
|
@@ -127,6 +148,15 @@ max-args = 8
|
|
|
127
148
|
[tool.ruff.lint.pep8-naming]
|
|
128
149
|
classmethod-decorators = ["classmethod", "validator", "root_validator", "pydantic.validator"]
|
|
129
150
|
|
|
151
|
+
[tool.pydoclint]
|
|
152
|
+
style = "google"
|
|
153
|
+
exclude = '\.git|\.nox'
|
|
154
|
+
arg-type-hints-in-docstring = false
|
|
155
|
+
check-return-types = false
|
|
156
|
+
check-yield-types = false
|
|
157
|
+
allow-init-docstring = true
|
|
158
|
+
quiet = true
|
|
159
|
+
|
|
130
160
|
[tool.ruff.lint.per-file-ignores]
|
|
131
161
|
"*/__init__.py" = ["F401"]
|
|
132
162
|
"**/tests/*" = [
|
|
@@ -143,7 +173,3 @@ classmethod-decorators = ["classmethod", "validator", "root_validator", "pydanti
|
|
|
143
173
|
"D103",
|
|
144
174
|
"S101", # asserts are encouraged in pytest
|
|
145
175
|
]
|
|
146
|
-
|
|
147
|
-
[build-system]
|
|
148
|
-
requires = ["poetry-core>=1.0.0"]
|
|
149
|
-
build-backend = "poetry.core.masonry.api"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
|
-
from datetime import UTC
|
|
5
4
|
from datetime import datetime
|
|
6
5
|
from datetime import timedelta
|
|
6
|
+
from datetime import timezone
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
|
|
9
9
|
import google.auth
|
|
@@ -142,7 +142,9 @@ class AuthClient:
|
|
|
142
142
|
)
|
|
143
143
|
response.raise_for_status()
|
|
144
144
|
auth_data = response.json()
|
|
145
|
-
expiry = datetime.now(
|
|
145
|
+
expiry = datetime.now(timezone.utc) + timedelta(
|
|
146
|
+
seconds=auth_data["expires_in"]
|
|
147
|
+
)
|
|
146
148
|
access_token = auth_data["access_token"]
|
|
147
149
|
|
|
148
150
|
return access_token, expiry
|
|
@@ -195,7 +197,9 @@ class AuthClient:
|
|
|
195
197
|
|
|
196
198
|
if response.status == 200:
|
|
197
199
|
auth_data = json.loads(response.data)
|
|
198
|
-
expiry = datetime.now(
|
|
200
|
+
expiry = datetime.now(timezone.utc) + timedelta(
|
|
201
|
+
seconds=auth_data["expires_in"]
|
|
202
|
+
)
|
|
199
203
|
return auth_data["access_token"], expiry
|
|
200
204
|
error = json.loads(response.data)
|
|
201
205
|
print("Error: ", error.get("error_description", "Unknown error"))
|
|
@@ -290,8 +294,8 @@ class AuthClient:
|
|
|
290
294
|
it raises a RuntimeError.
|
|
291
295
|
|
|
292
296
|
Args:
|
|
293
|
-
scopes
|
|
294
|
-
audiences
|
|
297
|
+
scopes: Optional list of scopes to include in the token request (ex. current_group, all_groups). Defaults to current_group.
|
|
298
|
+
audiences: Optional list of audiences to include in the token exchange request.
|
|
295
299
|
|
|
296
300
|
Raises:
|
|
297
301
|
RuntimeError: If the region is not DAPLA_LAB.
|
|
@@ -343,7 +347,7 @@ class MissingConfigurationException(Exception):
|
|
|
343
347
|
"""Initializes a new instance of the MissingConfigurationException class.
|
|
344
348
|
|
|
345
349
|
Args:
|
|
346
|
-
variable_name
|
|
350
|
+
variable_name: The name of the missing environment variable or configuration.
|
|
347
351
|
"""
|
|
348
352
|
self.variable_name = variable_name
|
|
349
353
|
self.message = f"Missing required environment variable: {variable_name}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|