diff --git a/tibber/__init__.py b/tibber/__init__.py index dbbfbc4..1d5e800 100644 --- a/tibber/__init__.py +++ b/tibber/__init__.py @@ -78,7 +78,7 @@ async def execute( self, document: str, variable_values: dict[Any, Any] | None = None, - timeout: int | None = None, + timeout: int | None = None, # noqa: ASYNC109 retry: int = 3, ) -> dict[Any, Any] | None: """Execute a GraphQL query and return the data. @@ -92,15 +92,16 @@ async def execute( payload = {"query": document, "variables": variable_values or {}} - post_args = { - "headers": { - "Authorization": "Bearer " + self._access_token, - aiohttp.hdrs.USER_AGENT: self._user_agent, - }, - "data": payload, - } try: - resp = await self.websession.post(API_ENDPOINT, **post_args, timeout=self.timeout) + resp = await self.websession.post( + API_ENDPOINT, + headers={ + "Authorization": "Bearer " + self._access_token, + aiohttp.hdrs.USER_AGENT: self._user_agent, + }, + data=payload, + timeout=aiohttp.ClientTimeout(total=self.timeout), + ) return (await extract_response_data(resp)).get("data") except (TimeoutError, aiohttp.ClientError) as err: if retry > 0: