- commit
- 73c88ab7bec8aab2648925d06f87be347453cd17
- parent
- 7370c46466f394e085a6d12cf9f87a001468b63d
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-04-25 10:21
fix aiohttp context managers
Diffstat
| M | quickstream/__init__.py | 14 | +++++++------- |
1 files changed, 7 insertions, 7 deletions
diff --git a/quickstream/__init__.py b/quickstream/__init__.py
@@ -16,23 +16,23 @@ class Client: 16 16 self.session = session 17 17 18 18 async def fetch(self, url, **kwargs):19 -1 r = await self.session.get(url, **kwargs)20 -1 return await r.read()-1 19 async with await self.session.get(url, **kwargs) as r: -1 20 return await r.read() 21 21 22 22 async def fetch_html(self, url, **kwargs): 23 23 html = await self.fetch(url, **kwargs) 24 24 return BeautifulSoup(html, 'html.parser') 25 25 26 26 async def fetch_json(self, url, **kwargs):27 -1 r = await self.session.get(url, **kwargs)28 -1 return await r.json()-1 27 async with await self.session.get(url, **kwargs) as r: -1 28 return await r.json() 29 29 30 30 async def graphql(self, url, query, **kwargs):31 -1 r = await self.session.post(url, json={-1 31 async with await self.session.post(url, json={ 32 32 'query': query, 33 33 'variables': kwargs,34 -1 })35 -1 return await r.json()-1 34 }) as r: -1 35 return await r.json() 36 36 37 37 38 38 async def extract(url):