From 8458a9fb8d2c73ca4a755b1735b93b7a8502e2ad Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Fri, 13 Sep 2024 19:11:40 +0100 Subject: Add the printful store ID to the authorized client as a header --- thallium-backend/src/settings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3