Skip to main content

飞快的请求库

Project description

JFSmallThread

简易版并发请求库:支持http协议高并发发送,比 aiohttp和requests 更快。 设置tps,控制函数发送速度, 提高执行效率

N|Solid

Build Status

Installation

pip install JFSmallThread

设置tps
tps_pool = TpsThreadPoolExecutor(tps=20)
    for i in range(100):
        # tps_pool.submit(f1, i)
        tps_pool.submit(test_by_nb_http_client)
    tps_pool.shutdown()
    
不设置
http_pool = ObjectPool(object_type=HttpOperator, object_pool_size=50,
                       object_init_kwargs=dict(host='xxxx', port=xxx),
                       max_idle_seconds=30)

thread_pool = BoundedThreadPoolExecutor(50)


def test_http_client():
    """
    type: typing.Union[HttpOperator,HTTPConnection]
    http对象池的请求速度暴击requests的session和直接requests.get
    """
    with http_pool.get() as conn:
        r1 = conn.speed_request()
        print(r1.text)

License

MIT

Free Software, Hell Yeah!

Project details


Download files

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

Source Distribution

JFSmallThread-1.0.0.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file JFSmallThread-1.0.0.tar.gz.

File metadata

  • Download URL: JFSmallThread-1.0.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for JFSmallThread-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dc70caa6ad6c6afb9285821dc3013827ba2a187fead200a2da75d8cd03b27781
MD5 3450d6ffcf66dc8c59857ce48a323264
BLAKE2b-256 a35f568493b77e19828518092f332fd2417c02d26f629bd7f506705f22c01f1d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page