diff --git a/packages/gg_api_core/src/gg_api_core/client.py b/packages/gg_api_core/src/gg_api_core/client.py index 2a005fc..60d8b0b 100644 --- a/packages/gg_api_core/src/gg_api_core/client.py +++ b/packages/gg_api_core/src/gg_api_core/client.py @@ -432,7 +432,7 @@ async def _request(self, method: str, endpoint: str, **kwargs) -> Any: while retry_count <= max_retries: try: - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(follow_redirects=True) as client: logger.debug(f"Sending {method} request to {url}") response = await client.request(method, url, headers=headers, **kwargs) @@ -652,7 +652,7 @@ async def _request_list(self, endpoint: str, **kwargs) -> ListResponse: } headers.update(kwargs.pop("headers", {})) - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(follow_redirects=True) as client: response = await client.get(url, headers=headers, **kwargs) response.raise_for_status() diff --git a/packages/gg_api_core/src/gg_api_core/oauth.py b/packages/gg_api_core/src/gg_api_core/oauth.py index ecadf7a..9978aba 100644 --- a/packages/gg_api_core/src/gg_api_core/oauth.py +++ b/packages/gg_api_core/src/gg_api_core/oauth.py @@ -690,7 +690,7 @@ async def redirect_handler(authorization_url: str) -> None: "User-Agent": f"MCP-Server/{self.token_name}", # Include in user agent } - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(follow_redirects=True) as client: response = await client.post(token_url, data=token_params, headers=headers) if response.status_code == 200: @@ -763,7 +763,7 @@ async def _fetch_token_info(self) -> APITokenInfo | None: try: import httpx # Import here to avoid circular imports - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(follow_redirects=True) as client: # Use the correct API endpoint with the full path response = await client.get( f"{self.api_url}/api_tokens/self",