Skip to main content

fast_requests

介绍

这可能是最快的http请求库,暂支持get方法

要求

windows平台和python3.7.2

使用

下载fast_requetst_cpp.pydfast_requests.pylibcurl.dllzlibd1.dll四个文件,在项目中导入fast_requests.py

api

#timeOut 单位为毫秒
get(urls, headers={}, nThread=5, isDebug=False, timeOut=3000, verifySsl=True)

sessionGet(urls, headers={}, nThread=5, isDebug=False, timeOut=3000, verifySsl=True)

#sessionGet和get的区别:sessionGet为每个线程持有一个session对象相当于requests的session,建议使用sessionGet速度更快
urls 请求的网址列表
headers 请求头
nThread 线程数看自己设备配置一般设20就差不多了
isDebug 开启后会打印每个线程每个请求信息
timeOut 超时
verifySsl ssl验证
返回 Response 对象列表

Response 对象

Response.text 正文text文本
Response.status_code 状态码
Response.header 
Response.content() 二进制数据 
Response.Url url 
Response.elapsed 
Response.cookies 
Response.error 暂且用不了

示例代码:

import fast_requests
urls = []
headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
for i in range(1, 200):
    urls.append("https://baidu.com")
for i in fast_requests.get(urls, headers, 20):
    print(i.text)

for i in fast_requests.sessionGet(urls, headers, 20):
    print(i.text)

原理

c++ : cpr
python : pybind11

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests-cpp-0.1.0.tar.gz (361.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requests_cpp-0.1.0-py3-none-any.whl (360.0 kB view details)

Uploaded Python 3

File details

Details for the file requests-cpp-0.1.0.tar.gz.

File metadata

  • Download URL: requests-cpp-0.1.0.tar.gz
  • Upload date:
  • Size: 361.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2

File hashes

Hashes for requests-cpp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c03a190e5aad83e7ad412c45468a4e4ede6bcc29b1bd6b0bcad7a55853172ef9
MD5 9adbfd7515571b6c134cdb8fd6deaccd
BLAKE2b-256 a937d90f5ec540e15f4dbcbd897e23c517ed480e163052dcdc49463d36cde513

See more details on using hashes here.

File details

Details for the file requests_cpp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: requests_cpp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 360.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2

File hashes

Hashes for requests_cpp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ff9fb691863f78cf7209daec057502f601be21d1fad0f57684bf0b4c89e60b5
MD5 19280b0c91b19c9e0a89e8d48fba7f1f
BLAKE2b-256 82932720cb991207e99cc4f1952003d934218b703ecdf578fd0915ad8b9ea912

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page