pixel-client 1.2.2__tar.gz → 1.2.3__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.
- {pixel_client-1.2.2 → pixel_client-1.2.3}/PKG-INFO +4 -7
- {pixel_client-1.2.2 → pixel_client-1.2.3}/README.md +3 -6
- {pixel_client-1.2.2 → pixel_client-1.2.3}/pyproject.toml +1 -1
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/_base.py +5 -5
- pixel_client-1.2.3/src/pixel_client/settings.py +63 -0
- pixel_client-1.2.2/src/pixel_client/settings.py +0 -42
- {pixel_client-1.2.2 → pixel_client-1.2.3}/.gitignore +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/LICENSE.txt +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/__init__.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/_sync.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/auth.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/exceptions.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/models.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/py.typed +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/types.py +0 -0
- {pixel_client-1.2.2 → pixel_client-1.2.3}/src/pixel_client/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pixel-client
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: Client library for Geodata Pixel
|
|
5
5
|
Project-URL: Documentation, https://doc.geodatapixel.no/
|
|
6
6
|
Project-URL: Organization, https://geodata.no
|
|
@@ -64,12 +64,9 @@ client = get_client()
|
|
|
64
64
|
|
|
65
65
|
# Using direct settings
|
|
66
66
|
settings = PixelApiSettings(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
KEYCLOAK_REALM="your_realm",
|
|
71
|
-
KEYCLOAK_USERNAME="your_username",
|
|
72
|
-
KEYCLOAK_PASSWORD="your_password"
|
|
67
|
+
PIXEL_TENANT="your_realm",
|
|
68
|
+
PIXEL_USERNAME="your_username",
|
|
69
|
+
PIXEL_PASSWORD="your_password"
|
|
73
70
|
)
|
|
74
71
|
client = get_client(settings=settings)
|
|
75
72
|
|
|
@@ -43,12 +43,9 @@ client = get_client()
|
|
|
43
43
|
|
|
44
44
|
# Using direct settings
|
|
45
45
|
settings = PixelApiSettings(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
KEYCLOAK_REALM="your_realm",
|
|
50
|
-
KEYCLOAK_USERNAME="your_username",
|
|
51
|
-
KEYCLOAK_PASSWORD="your_password"
|
|
46
|
+
PIXEL_TENANT="your_realm",
|
|
47
|
+
PIXEL_USERNAME="your_username",
|
|
48
|
+
PIXEL_PASSWORD="your_password"
|
|
52
49
|
)
|
|
53
50
|
client = get_client(settings=settings)
|
|
54
51
|
|
|
@@ -151,11 +151,11 @@ class PixelClientAsync:
|
|
|
151
151
|
"""
|
|
152
152
|
return cls(
|
|
153
153
|
url=settings.PIXEL_API_URL,
|
|
154
|
-
keycloak_server_url=settings.
|
|
155
|
-
client_id=settings.
|
|
156
|
-
username=settings.
|
|
157
|
-
password=settings.
|
|
158
|
-
realm=settings.
|
|
154
|
+
keycloak_server_url=settings.PIXEL_SERVER_URL,
|
|
155
|
+
client_id=settings.PIXEL_CLIENT_ID,
|
|
156
|
+
username=settings.PIXEL_USERNAME,
|
|
157
|
+
password=settings.PIXEL_PASSWORD.get_secret_value(),
|
|
158
|
+
realm=settings.PIXEL_REALM,
|
|
159
159
|
**kwargs,
|
|
160
160
|
)
|
|
161
161
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from pydantic import SecretStr, Field, AliasChoices
|
|
5
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
pixel_env_choices = AliasChoices("PIXEL_ENV", "KEYCLOAK_ENV")
|
|
9
|
+
pixel_username_choices = AliasChoices("PIXEL_USERNAME", "KEYCLOAK_USERNAME")
|
|
10
|
+
pixel_password_choices = AliasChoices("PIXEL_PASSWORD", "KEYCLOAK_PASSWORD")
|
|
11
|
+
pixel_realm_choices = AliasChoices("PIXEL_TENANT", "KEYCLOAK_REALM")
|
|
12
|
+
|
|
13
|
+
class PixelApiSettings(BaseSettings):
|
|
14
|
+
"""
|
|
15
|
+
Settings for the Pixel API client
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def from_env_file(cls, env_file: Path | str) -> "PixelApiSettings":
|
|
20
|
+
"""Instantiate the settings from an environment file.
|
|
21
|
+
|
|
22
|
+
Warning:
|
|
23
|
+
Environment variables will always take precedence over the values in the file.
|
|
24
|
+
"""
|
|
25
|
+
return cls(_env_file=env_file) # type: ignore
|
|
26
|
+
|
|
27
|
+
model_config = SettingsConfigDict(frozen=True, extra="ignore") # Makes it hashable
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
PIXEL_ENV: Literal["dev", "test", "prod"] = Field(validation_alias=pixel_env_choices, default="prod")
|
|
32
|
+
|
|
33
|
+
PIXEL_USERNAME: str = Field(validation_alias=pixel_username_choices)
|
|
34
|
+
"""The client secret for the Keycloak server"""
|
|
35
|
+
|
|
36
|
+
PIXEL_PASSWORD: SecretStr = Field(validation_alias=pixel_password_choices)
|
|
37
|
+
"""The password for the Keycloak"""
|
|
38
|
+
|
|
39
|
+
PIXEL_TENANT: str = Field(validation_alias=pixel_realm_choices)
|
|
40
|
+
"""The realm for the Keycloak server"""
|
|
41
|
+
|
|
42
|
+
PIXEL_SERVER_URL_OVERRIDE: str | None = Field(alias="PIXEL_SERVER_URL", default=None)
|
|
43
|
+
PIXEL_API_URL_OVERRIDE: str | None = Field(alias="PIXEL_API_URL", default=None)
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def PIXEL_CLIENT_ID(self):
|
|
47
|
+
return "frontend"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def PIXEL_REALM(self):
|
|
52
|
+
return self.PIXEL_TENANT.capitalize()
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def PIXEL_API_URL(self):
|
|
56
|
+
return self.PIXEL_API_URL_OVERRIDE or f"https://{self.PIXEL_ENV}.api.geodatapixel.no/{self.PIXEL_REALM.lower()}"
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def PIXEL_SERVER_URL(self):
|
|
60
|
+
return self.PIXEL_SERVER_URL_OVERRIDE or f"https://{self.PIXEL_ENV}.keycloak.geodatapixel.no"
|
|
61
|
+
|
|
62
|
+
PIXEL_CLIENT_NO_VERSION_CHECK: bool = False
|
|
63
|
+
"""If True, the client will not check for a newer version of the pixel-client package on startup."""
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
|
|
3
|
-
from pydantic import SecretStr
|
|
4
|
-
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class PixelApiSettings(BaseSettings):
|
|
8
|
-
"""
|
|
9
|
-
Settings for the Pixel API client
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
@classmethod
|
|
13
|
-
def from_env_file(cls, env_file: Path | str) -> "PixelApiSettings":
|
|
14
|
-
"""Instantiate the settings from an environment file.
|
|
15
|
-
|
|
16
|
-
Warning:
|
|
17
|
-
Environment variables will always take precedence over the values in the file.
|
|
18
|
-
"""
|
|
19
|
-
return cls(_env_file=env_file) # type: ignore
|
|
20
|
-
|
|
21
|
-
model_config = SettingsConfigDict(frozen=True) # Makes it hashable
|
|
22
|
-
|
|
23
|
-
PIXEL_API_URL: str
|
|
24
|
-
"""The URL of the Pixel API"""
|
|
25
|
-
|
|
26
|
-
KEYCLOAK_SERVER_URL: str
|
|
27
|
-
"""The URL for the Keycloak server"""
|
|
28
|
-
|
|
29
|
-
KEYCLOAK_CLIENT_ID: str = "frontend"
|
|
30
|
-
"""The client ID for the Keycloak server"""
|
|
31
|
-
|
|
32
|
-
KEYCLOAK_USERNAME: str
|
|
33
|
-
"""The client secret for the Keycloak server"""
|
|
34
|
-
|
|
35
|
-
KEYCLOAK_PASSWORD: SecretStr
|
|
36
|
-
"""The password for the Keycloak"""
|
|
37
|
-
|
|
38
|
-
KEYCLOAK_REALM: SecretStr
|
|
39
|
-
"""The realm for the Keycloak server"""
|
|
40
|
-
|
|
41
|
-
PIXEL_CLIENT_NO_VERSION_CHECK: bool = False
|
|
42
|
-
"""If True, the client will not check for a newer version of the pixel-client package on startup."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|