1.aiohttp的简单使用(配合asyncio模块)
import asyncio,aiohttpasync def fetch_async(url): print(url) async with aiohttp.request("GET",url) as r: reponse = await r.text(encoding="utf-8") #或者直接await r.read()不编码,直接读取,适合于图像等无法编码文件 print(reponse)tasks = [fetch_async('http://press(my_data) headers = {'Content-Encoding': 'deflate'} async with session.post('http://httpbin.org/post', data=data, headers=headers) pass以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。