Skip to content

Commit 7876eb8

Browse files
authored
Create aiohttp_class.py
1 parent 27bb8f3 commit 7876eb8

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import aiohttp
2+
3+
4+
class AioHttp:
5+
@staticmethod
6+
async def get_json(link):
7+
async with aiohttp.ClientSession() as session:
8+
async with session.get(link) as resp:
9+
return await resp.json()
10+
11+
@staticmethod
12+
async def get_text(link):
13+
async with aiohttp.ClientSession() as session:
14+
async with session.get(link) as resp:
15+
return await resp.text()
16+
17+
@staticmethod
18+
async def get_raw(link):
19+
async with aiohttp.ClientSession() as session:
20+
async with session.get(link) as resp:
21+
return await resp.read()
22+

0 commit comments

Comments
 (0)