"""HTTP client for ows-product-digital integration tests.""" import os import requests BASE_URL = os.environ.get( "OWS_PRODUCT_DIGITAL_BASE_URL", "https://qa-ows-product-digital.theorchard.io", ) class OwsProductDigital: """Typed HTTP client for ows-product-digital integration tests. Authenticates using a JWT bearer token. All methods return the raw requests.Response so tests can assert on status codes and body. """ def __init__(self, jwt: str) -> None: """Initialize client with a bearer token.""" self._session = requests.Session() self._session.headers.update({ "Authorization": f"Bearer {jwt}", "Content-Type": "application/json", }) def get_audio_product(self, product_id: int) -> requests.Response: """GET /product/audio/{product_id}.""" return self._session.get(f"{BASE_URL}/product/audio/{product_id}") def get_meta_language(self) -> requests.Response: """GET /meta-language.""" return self._session.get(f"{BASE_URL}/meta-language") def dataload_product_audio_validation( self, product_ids: list[int], account_type: str = "", account_id: str = "", orchard_user_id: str = "", ) -> requests.Response: """POST /product/audio/validate/dataloader.""" headers = {} if account_type: headers["Grass-Account-Type"] = account_type if account_id: headers["Grass-Account-Id"] = account_id if orchard_user_id: headers["Orchard-User-Id"] = orchard_user_id return self._session.post( f"{BASE_URL}/product/audio/validate/dataloader", json={"product_ids": product_ids}, headers=headers, )