快速获取多个页面
mucri的Python项目详细描述
穆克里
使用pythonasyncio
快速获取许多页面/api。
安装
Only python 3.6+
pip isntall mucri
用法
fetch_pages
接受两个参数:
links
:要获取的链接列表(下面的示例)
concurrency
:一次要发送多少请求(默认为20)
frommucriimportfetch_pages# links can be a single string or a dict with specific instructionslinks=["http://meain.github.io",# Can be just a url{"url":"http://somelink"},# or a dict with url key{# for more complex stuff"url":"http://fakelink","action":"get",# get | post"data":{},"headers":{},"resp_type":"text",# text | json | image}]results=fetch_pages(links)# fetches all of them asynchronously