{"id":50572226,"url":"https://github.com/serpapi/wreq-rb","last_synced_at":"2026-06-04T19:30:39.953Z","repository":{"id":337796078,"uuid":"1155257723","full_name":"serpapi/wreq-rb","owner":"serpapi","description":"Ruby HTTP client featuring TLS fingerprint emulation, HTTP/2 support, cookie handling, and proxy support.","archived":false,"fork":false,"pushed_at":"2026-03-30T04:31:45.000Z","size":102,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-25T07:07:26.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serpapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-11T10:00:37.000Z","updated_at":"2026-04-17T15:02:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/serpapi/wreq-rb","commit_stats":null,"previous_names":["zyc9012/wreq-rb","serpapi/wreq-rb"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/serpapi/wreq-rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fwreq-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fwreq-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fwreq-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fwreq-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serpapi","download_url":"https://codeload.github.com/serpapi/wreq-rb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fwreq-rb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33917183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-04T19:30:39.236Z","updated_at":"2026-06-04T19:30:39.940Z","avatar_url":"https://github.com/serpapi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wreq-rb\n\nRuby bindings for the [wreq](https://github.com/0x676e67/wreq) Rust HTTP client — featuring TLS fingerprint emulation, HTTP/2 support, cookie handling, and proxy support.\n\n## Installation\n\nAdd to your Gemfile:\n\n```ruby\ngem \"wreq-rb\"\n```\n\nThen run:\n\n```bash\nbundle install\n```\n\n\u003e **Build prerequisites:** You need Rust (1.85+), Clang, CMake, and Perl installed, since wreq compiles BoringSSL from source. See [wreq's build guide](https://github.com/0x676e67/wreq#building) for details.\n\n## Quick Start\n\n```ruby\nrequire \"wreq-rb\"\n\n# Simple GET request\nresp = Wreq.get(\"https://httpbin.org/get\")\nputs resp.status   # =\u003e 200\nputs resp.text     # =\u003e response body as string\nputs resp.json     # =\u003e parsed Ruby Hash\n\n# POST with JSON body\nresp = Wreq.post(\"https://httpbin.org/post\", json: { name: \"wreq\", version: 1 })\n\n# POST with form data\nresp = Wreq.post(\"https://httpbin.org/post\", form: { key: \"value\" })\n\n# Custom headers\nresp = Wreq.get(\"https://httpbin.org/headers\",\n  headers: { \"X-Custom\" =\u003e \"value\", \"Accept\" =\u003e \"application/json\" })\n\n# Query parameters\nresp = Wreq.get(\"https://httpbin.org/get\", query: { foo: \"bar\", page: \"1\" })\n\n# Authentication\nresp = Wreq.get(\"https://httpbin.org/bearer\", bearer: \"my-token\")\nresp = Wreq.get(\"https://httpbin.org/basic-auth/user/pass\", basic: [\"user\", \"pass\"])\n\n# Browser emulation (enabled by default)\nresp = Wreq.get(\"https://tls.peet.ws/api/all\", emulation: \"chrome_143\")\n```\n\n## Using a Client\n\nFor best performance, create a `Wreq::Client` and reuse it across requests (connections are pooled internally):\n\n```ruby\nclient = Wreq::Client.new(\n  user_agent: \"MyApp/1.0\",\n  timeout: 30,                 # total timeout in seconds\n  connect_timeout: 5,          # connection timeout\n  read_timeout: 15,            # read timeout\n  redirect: 10,                # follow up to 10 redirects (false to disable)\n  cookie_store: true,          # enable cookie jar\n  proxy: \"http://proxy:8080\",  # proxy URL (supports http, https, socks5)\n  proxy_user: \"user\",          # proxy auth\n  proxy_pass: \"pass\",\n  no_proxy: true,              # disable all proxies (including env-vars)\n  https_only: false,           # restrict to HTTPS\n  verify_host: true,           # verify TLS hostname (default: true)\n  verify_cert: true,           # verify TLS certificate (default: true)\n  http1_only: false,           # force HTTP/1.1 only\n  http2_only: false,           # force HTTP/2 only\n  gzip: true,                  # enable gzip decompression\n  brotli: true,                # enable brotli decompression\n  deflate: true,               # enable deflate decompression\n  zstd: true,                  # enable zstd decompression\n  emulation: \"chrome_143\",     # browser emulation (enabled by default)\n  emulation_os: \"windows\",     # OS emulation: windows, macos (default), linux, android, ios\n  header_order: [              # wire order of headers (names only, case-sensitive)\n    \"host\",                    # listed headers appear first in the given order, remaining\n    \"user-agent\",              # emulation headers follow.\n    \"accept\",\n  ],\n  headers: {                   # default headers for all requests\n    \"Accept\" =\u003e \"application/json\"\n  },\n  referer: true,               # auto-set Referer header on redirects (default: true)\n  pool_max_idle_per_host: 10,  # max idle connections per host\n  pool_max_size: 100,          # max total connections in the pool\n  tcp_nodelay: true,           # disable Nagle algorithm (default: true)\n  tcp_keepalive: 15,           # SO_KEEPALIVE interval in seconds (default: 15)\n  local_address: \"1.2.3.4\",    # bind outgoing connections to this source IP\n  tls_sni: true,               # send SNI in TLS handshake (default: true)\n  min_tls_version: \"tls1.2\",   # minimum TLS version: tls1.0, tls1.1, tls1.2, tls1.3\n  max_tls_version: \"tls1.3\",   # maximum TLS version\n)\n\nresp = client.get(\"https://api.example.com/data\")\nresp = client.post(\"https://api.example.com/data\", json: { key: \"value\" })\n```\n\n## HTTP Methods\n\nAll methods are available on both `Wreq` (module-level) and `Wreq::Client` (instance-level):\n\n| Method | Usage |\n|--------|-------|\n| `get(url, **opts)` | GET request |\n| `post(url, **opts)` | POST request |\n| `put(url, **opts)` | PUT request |\n| `patch(url, **opts)` | PATCH request |\n| `delete(url, **opts)` | DELETE request |\n| `head(url, **opts)` | HEAD request |\n| `options(url, **opts)` | OPTIONS request |\n\n### Cancelling Requests\n\nCall `cancel` on a client to interrupt all in-flight requests immediately:\n\n```ruby\nclient = Wreq::Client.new\n\n# From another thread:\nt = Thread.new { client.get(\"https://slow.example.com/big-download\") }\nsleep 1\nclient.cancel  # all in-flight requests raise Wreq::Error with \"request interrupted\"\n```\n\n### Per-Request Options\n\nPass an options hash as the second argument to any HTTP method:\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `headers` | Hash | Request headers |\n| `body` | String | Raw request body |\n| `json` | Hash/Array | JSON-serialized body (sets Content-Type) |\n| `form` | Hash | URL-encoded form body |\n| `query` | Hash | URL query parameters |\n| `timeout` | Float | Per-request timeout (seconds) |\n| `auth` | String | Raw Authorization header |\n| `bearer` | String | Bearer token |\n| `basic` | Array | `[username, password]` for Basic auth |\n| `proxy` | String | Per-request proxy URL |\n| `emulation` | String/Boolean | Per-request emulation override |\n| `emulation_os` | String | OS emulation: `windows`, `macos`, `linux`, `android`, `ios` |\n\n## Browser Emulation\n\nwreq-rb emulates real browser TLS fingerprints, HTTP/2 settings, and headers by default. **The lastest supported Chrome is used when no emulation is specified.**\n\n```ruby\nresp = Wreq.get(\"https://tls.peet.ws/api/all\")\n\n# Explicit browser emulation\nclient = Wreq::Client.new(emulation: \"firefox_146\")\nclient = Wreq::Client.new(emulation: \"safari_18.5\")\nclient = Wreq::Client.new(emulation: \"edge_142\")\n\n# Disable emulation entirely\nclient = Wreq::Client.new(emulation: false)\n\n# Emulate a specific OS (default is macOS)\nclient = Wreq::Client.new(emulation: \"chrome_145\", emulation_os: \"windows\")\nclient = Wreq::Client.new(emulation: \"chrome_145\", emulation_os: \"linux\")\n\n# Emulation + custom user-agent (user_agent overrides emulation's UA)\nclient = Wreq::Client.new(emulation: \"chrome_143\", user_agent: \"MyBot/1.0\")\n\n# Per-request emulation override\nresp = client.get(\"https://example.com\", emulation: \"safari_26.2\")\n```\n\n### Supported Browsers\n\n| Browser | Example values |\n|---------|---------------|\n| Chrome | `chrome_100` .. `chrome_145` |\n| Firefox | `firefox_109` .. `firefox_147`, `firefox_private_135` |\n| Safari | `safari_15.3` .. `safari_26.2`, `safari_ios_26`, `safari_ipad_18` |\n| Edge | `edge_101` .. `edge_145` |\n| Opera | `opera_116` .. `opera_119` |\n| OkHttp | `okhttp_3_9` .. `okhttp_5` |\n\n## Response\n\nThe `Wreq::Response` object provides:\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `status` / `code` | Integer | HTTP status code |\n| `text` / `body` | String | Response body as string |\n| `body_bytes` | Array | Raw bytes |\n| `headers` | Hash | Response headers |\n| `json` | Hash/Array | JSON-parsed body |\n| `url` | String | Final URL (after redirects) |\n| `version` | String | HTTP version |\n| `content_length` | Integer/nil | Content length if known |\n| `transfer_size` | Integer/nil | Bytes transferred over the wire |\n| `success?` | Boolean | Status 2xx? |\n| `redirect?` | Boolean | Status 3xx? |\n| `client_error?` | Boolean | Status 4xx? |\n| `server_error?` | Boolean | Status 5xx? |\n\n## Building from Source\n\n```bash\nbundle install\nbundle exec rake compile\nbundle exec rake test\n```\n\n## License\n\nwreq-rb is released under the [Apache License, Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fwreq-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserpapi%2Fwreq-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fwreq-rb/lists"}