Skip to main content

high performance http requests library

Project description

Fiberhttp

Fiberhttp is for high-performance library

Supported Versions

The benchmarks folder contains comparisons between Fiberhttp and other well-known libraries such as requests, httpx, http.client, and others. You will notice that Fiberhttp outperforms them every time

Fiberhttp might not for you

Fiberhttp is designed to provide high performance but lacks many features like:

missing Features:

  • No support for handling file
  • No support for SOCKS proxies
  • No support for streaming requests

If these features are important to you, and you value compatibility and functionality over performance, then the requests library might be a better choice for you.

Features:

  • Keep-alive (socket connection)
  • Build bytes request before send the request
  • Create socket connection with server before send the request
  • High-performance SSL/TLS handshake, verify
  • Reading responses in various formats such as JSON, headers, and cookies

How to use

install Fiberhttp (supported all os systems)

pip install fiberhttp

with client session

import fiberhttp

# create client session with timeout
# ! timeout not requierd
cn = fiberhttp.client(timeout=10)

# send get request
res = cn.get('https://httpbin.org/ip')

status_code = res.status_code()
body = res.text()
headers = res.headers()['Date']
json = res.json()['origin']

without client session

import fiberhttp

# send request without create client
response = fiberhttp.get('https://httpbin.org/ip')

with proxies

import fiberhttp

# create client proxy
cn = fiberhttp.client_proxy('http://20.111.54.16:8123')

# send request after the proxy in the client session
response = cn.get('https://httpbin.org/ip').json()['origin']
print(response)

use build request for high performance

import fiberhttp

cn = fiberhttp.client()

# build request with this format
request = fiberhttp.build('GET', 'httpbin.org', '/ip')

# send request after build it
response = cn.send('httpbin.org', request).json()

create connection with host before send request to reduce response time

import fiberhttp

cn = fiberhttp.client()

request = fiberhttp.build('GET', 'httpbin.org', '/ip')
cn.connect('httpbin.org')

response = cn.send('httpbin.org', request).text()
print(response)

use build, create connection with proxies

import fiberhttp

cn = fiberhttp.client_proxy('http://username:password@host:port')

# if the proxy has authentication, you must include the proxy_auth argument, which can be obtained from the client
request = fiberhttp.build_proxy('GET', 'httpbin.org', '/ip', proxy_auth=cn.proxy_auth)

# connect befor send not required; but its better for high peformance
cn.connect('httpbin.org')

response = cn.send('httpbin.org', request).text()
print(response)

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

fiberhttp-1.3.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

fiberhttp-1.3.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file fiberhttp-1.3.1.tar.gz.

File metadata

  • Download URL: fiberhttp-1.3.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for fiberhttp-1.3.1.tar.gz
Algorithm Hash digest
SHA256 0ccd2314b9e0b5f8552c7a14b0335a03bfc995d98c4fcfd1e70eed1a49ce8664
MD5 82c74a0056e6a0214d2e75392bbbe6a0
BLAKE2b-256 e7dd5f482df6ce303fd8c8bc0a1a07e38c9ac15f46d4c87490e20240865e019c

See more details on using hashes here.

File details

Details for the file fiberhttp-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: fiberhttp-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for fiberhttp-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 947a8ca0e8fe03475f0077b79846b5f30605fa53a35ea8e9da7e40bca37e7f53
MD5 1dc88872f66cac1e66ad8d416e59af85
BLAKE2b-256 913c40c77b55438a6b405ee45304d381aa2a4efb745477b24a9d94bd49c1972d

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