aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-09-13 19:11:40 +0100
committerGravatar Chris Lovering <[email protected]>2024-09-13 19:11:40 +0100
commit8458a9fb8d2c73ca4a755b1735b93b7a8502e2ad (patch)
tree579b605640568dc7b6026d8e53d8a98b9dc0a83a
parentFix seed script user creation (diff)
Add the printful store ID to the authorized client as a header
-rw-r--r--thallium-backend/src/settings.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/thallium-backend/src/settings.py b/thallium-backend/src/settings.py
index 882ed68..b9f8763 100644
--- a/thallium-backend/src/settings.py
+++ b/thallium-backend/src/settings.py
@@ -29,6 +29,7 @@ class _Config(
database_url: pydantic.SecretStr
super_admin_token: pydantic.SecretStr
printful_token: pydantic.SecretStr
+ printful_store_id: pydantic.SecretStr
app_prefix: str = ""
templates: Jinja2Templates = Jinja2Templates(directory="src/templates")
@@ -49,7 +50,10 @@ class Connections:
async def _get_printful_client() -> AsyncGenerator[httpx.AsyncClient, None]:
"""Yield an authenticated httpx client for printful, for use with a FastAPI dependency."""
client = httpx.AsyncClient(
- headers={"Authorization": f"Bearer {CONFIG.printful_token.get_secret_value()}"},
+ headers={
+ "Authorization": f"Bearer {CONFIG.printful_token.get_secret_value()}",
+ "X-PF-Store-Id": CONFIG.printful_store_id.get_secret_value(),
+ },
base_url="https://api.printful.com",
)
async with client as c: