summaryrefslogtreecommitdiff
path: root/ATRI/modules/response/__init__.py
blob: 4a47140b349c8905dec0e5d5556f2f4669a654b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# -*- coding:utf-8 -*-
import requests
from aiohttp import ClientSession

def request_api(url):
    response = requests.request("GET", url)
    html = response.text
    return html

def request_api_params(url, params):
    response = requests.get(url, params = params)
    html = response.text
    return html

async def post_bytes(url, headers=None,data=None):
    async with ClientSession() as asyncsession:
        async with asyncsession.post(url,headers=headers,data=data) as response:
            b = await response.read()
    return b