settings
PixelApiSettings ¶
Bases: BaseSettings
Settings for the Pixel API client
Source code in src/pixel_client/settings.py
14 15 16 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
PIXEL_ENV
class-attribute
instance-attribute
¶
PIXEL_ENV: Literal["dev", "test", "prod"] = Field(
validation_alias=pixel_env_choices, default="prod"
)
PIXEL_USERNAME
class-attribute
instance-attribute
¶
PIXEL_USERNAME: str | None = Field(
validation_alias=pixel_username_choices, default=None
)
The username for the Keycloak server. Required unless PIXEL_API_KEY is set.
PIXEL_PASSWORD
class-attribute
instance-attribute
¶
PIXEL_PASSWORD: SecretStr | None = Field(
validation_alias=pixel_password_choices, default=None
)
The password for the Keycloak server. Required unless PIXEL_API_KEY is set.
PIXEL_API_KEY
class-attribute
instance-attribute
¶
PIXEL_API_KEY: SecretStr | None = None
A Pixel api key, used instead of PIXEL_USERNAME / PIXEL_PASSWORD.
Mint one with create_api_key. The
token is only ever shown once, at creation time.
PIXEL_TENANT
class-attribute
instance-attribute
¶
PIXEL_TENANT: str = Field(
validation_alias=pixel_realm_choices
)
The realm for the Keycloak server
PIXEL_AUTH_SERVER_URL_OVERRIDE
class-attribute
instance-attribute
¶
PIXEL_AUTH_SERVER_URL_OVERRIDE: str | None = Field(
alias="PIXEL_AUTH_SERVER_URL", default=None
)
PIXEL_API_URL_OVERRIDE
class-attribute
instance-attribute
¶
PIXEL_API_URL_OVERRIDE: str | None = Field(
alias="PIXEL_API_URL", default=None
)
PIXEL_CLIENT_NO_VERSION_CHECK
class-attribute
instance-attribute
¶
PIXEL_CLIENT_NO_VERSION_CHECK: bool = False
If True, the client will not check for a newer version of the pixel-client package on startup.
from_env_file
classmethod
¶
from_env_file(env_file: Path | str) -> PixelApiSettings
Instantiate the settings from an environment file.
Warning
Environment variables will always take precedence over the values in the file.
Source code in src/pixel_client/settings.py
19 20 21 22 23 24 25 26 | |
validate_credentials ¶
validate_credentials() -> PixelApiSettings
Require exactly one set of credentials: an api key, or a username and password.
Source code in src/pixel_client/settings.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |