Skip to content

Commit 4373835

Browse files
bouwewbrefra
authored andcommitted
Revert "Remove aiohttp-workaround"
This reverts commit 9b3239a.
1 parent fc1a5ee commit 4373835

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugwise/smile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ async def _create_session() -> aiohttp.ClientSession:
8787
self.websession = websession
8888

8989
self._auth = aiohttp.BasicAuth(username, password=password)
90+
# Work-around for Stretchv2-aiohttp-deflate-error, can be removed for aiohttp v3.7
91+
self._headers = {"Accept-Encoding": "gzip"}
9092

9193
self._timeout = timeout
9294
self._endpoint = f"http://{host}:{str(port)}"
@@ -230,7 +232,10 @@ async def request(
230232
try:
231233
with async_timeout.timeout(self._timeout):
232234
if method == "get":
233-
resp = await self.websession.get(url, auth=self._auth)
235+
# Work-around, see above, can be removed for aiohttp v3.7:
236+
resp = await self.websession.get(
237+
url, auth=self._auth, headers=self._headers
238+
)
234239
if method == "put":
235240
resp = await self.websession.put(
236241
url, data=data, headers=headers, auth=self._auth

0 commit comments

Comments
 (0)