aclient
安装说明
使用pip或其他 PyPi 软件包进行安装
pip install aclient
使用 aclient 发送异步请求
您可以试试:
import re
from aclient import *
aclient = AsyncClient()
# 自定义解析函数 注意; 函数必需是异步的
async def parse(response, **kwargs):
text = await response.text()
# 测试: 获取 title 文本 - 百度一下
pattern = re.compile(f"<title>(.*?)</title>")
title = pattern.findall(text)[0]
return title
# 请求地址 可以发送大量地址
url = "https://www.baidu.com"
# urls列表格式
urls = [url for _ in range(2)]
result = aclient.get(urls, custom_parse=parse)
# 打印item数据
print(result)
# 结果
# result = {'0': '百度一下', '1': '百度一下'}
# urls字典格式
urls = {
f"第{i}个": {"url": url, "timeout": 5}
for i in range(2)
}
result = aclient.get(urls, custom_parse=parse)
# 打印item数据
print(result)
# 结果
# result = {'第0个': '百度一下', '第1个': '百度一下'}
Metadata
Release files for aclient 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aclient-1.0.7.tar.gz | 6.2 kB | Without provenance | Details for aclient-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aclient-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for aclient-1.0.7-py3-none-any.whl |
Total release size: 13.4 kB
Release files / aclient-1.0.7.tar.gz
| Download URL | aclient-1.0.7.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d6c0bc3ec74868f20dba02fd557e22d37a63de688f3b1f95d9007cf0d2f9158
|
|
BLAKE2b-256 checksum How to use checksums |
603cbbc287192927921c7265b55d5095cba7c0e2a9e7dcad3de308c580257e1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / aclient-1.0.7-py3-none-any.whl
| Download URL | aclient-1.0.7-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a00413e78e7162f89206392c65f35c445816e1faee1254b37b792f839529ee27
|
|
BLAKE2b-256 checksum How to use checksums |
6a890078f29a9275844b7b0d0cdd170653f39af55611ff1f9d7192124e304b6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for aclient 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.