Skip to content

hrequestsvshttparty

MIT 51 1 1,001
33.3 thousand (month) Feb 23 2022 0.9.2(2024-12-01 02:55:27 ago)
5,889 8 43 MIT
Jul 25 2009 2.2 million (month) 0.24.2(2026-01-14 22:54:36 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

HTTParty is a Ruby library that makes it easy to work with HTTP requests and responses. It is built on top of the Ruby standard library's Net::HTTP and provides a simple, easy-to-use interface for making requests and handling responses.

One of the main features of HTTParty is its ability to automatically parse response bodies as JSON, XML, or other formats. This allows developers to easily access the data returned by an API without having to manually parse the response.

Highlights


bypasshttp2tls-fingerprinthttp-fingerprintsyncasync

Example Use


hrequests has almost identical API and UX as requests and here's a quick overview: ```python 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 ```
```ruby require 'httparty' # get request: response = HTTParty.get('http://httpbin.org/get') puts response.body puts response.code puts response.message puts response.headers.inspect # post request response = HTTParty.post('http://httpbin.org/post', :body => { :title => 'foo', :body => 'bar', :userId => 1 }.to_json, :headers => { 'Content-Type' => 'application/json' } ) puts response.body ```

Alternatives / Similar


Was this page helpful?