Skip to content

hrequestsvshttp.rb

Apache-2.0 17 1 585
5.5 thousand (month) Feb 23 2022 0.8.2(4 months ago)
2,999 10 90 NA
Mar 20 2015 448 (month) 0.12.0(6 years ago)

hrequests is a feature rich modern replacement for a famous requests library for Python. It provides a feature rich HTTP client capable of resisting popular scraper identification techniques: - Seamless transition between headless browser and http client based requests - Integrated HTML parser - Mimicking of real browser TLS fingerprints - Javascript rendering - HTTP2 support - Realistic browser headers

http is an HTTP library for Ruby, it's a fork of the Ruby standard library Net::HTTP. It is designed to provide a more modern and consistent API for making HTTP requests and handling responses.

One of the main goals of http is to simplify the process of making HTTP requests and handling responses. It provides a consistent API for making requests and handling responses across different versions of Ruby and different HTTP libraries, making it easier to write cross-compatible code.

http supports all the standard HTTP methods such as GET, POST, PUT, DELETE, and PATCH, and allows you to set headers, query parameters, and request bodies.

Highlights


bypasshttp2tls-fingerprinthttp-fingerprintsyncasync

Example Use


hrequests has almost identical API and UX as requests and here's a quick overview:
import hrequests

# perform HTTP client requests
resp = hrequests.get('https://httpbin.org/html')
print(resp.status_code)
# 200

# use headless browsers and sessions:
session = hrequests.Session('chrome', version=122, os="mac")

# supports asyncio and easy concurrency
requests = [
    hrequests.async_get('https://www.google.com/', browser='firefox'),
    hrequests.async_get('https://www.duckduckgo.com/'),
    hrequests.async_get('https://www.yahoo.com/'),
    hrequests.async_get('https://www.httpbin.org/'),
]
responses = hrequests.map(requests, size=3)  # max 3 conccurency
require 'http'

# GET request
response = HTTP.get("http://httpbin.org/get")
puts response.body
puts response.status
puts response.headers

# POST request
response = HTTP.post("http://httpbin.org/post", json: { title: 'foo', body: 'bar', userId: 1 })
puts response.body

Alternatives / Similar


Was this page helpful?