{"id":32173415,"url":"https://github.com/petrohi/machine_gun","last_synced_at":"2025-10-21T18:54:20.620Z","repository":{"id":49562744,"uuid":"117356083","full_name":"petrohi/machine_gun","owner":"petrohi","description":"HTTP/1 and HTTP/2 client for Elixir. Based on Gun and Poolboy.","archived":false,"fork":false,"pushed_at":"2025-02-12T18:15:50.000Z","size":37,"stargazers_count":64,"open_issues_count":6,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-21T18:54:11.360Z","etag":null,"topics":["elixir","gun","http","http2","poolboy"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petrohi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-13T15:48:06.000Z","updated_at":"2025-02-12T18:15:55.000Z","dependencies_parsed_at":"2022-08-20T10:10:26.398Z","dependency_job_id":null,"html_url":"https://github.com/petrohi/machine_gun","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/petrohi/machine_gun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrohi%2Fmachine_gun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrohi%2Fmachine_gun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrohi%2Fmachine_gun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrohi%2Fmachine_gun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petrohi","download_url":"https://codeload.github.com/petrohi/machine_gun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrohi%2Fmachine_gun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280317282,"owners_count":26309997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"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":["elixir","gun","http","http2","poolboy"],"created_at":"2025-10-21T18:54:19.557Z","updated_at":"2025-10-21T18:54:20.615Z","avatar_url":"https://github.com/petrohi.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Hex.pm version](https://img.shields.io/hexpm/v/machine_gun.svg)](https://hex.pm/packages/machine_gun)\n[![Hex.pm downloads](https://img.shields.io/hexpm/dt/machine_gun.svg)](https://hex.pm/packages/machine_gun)\n[![Build Status](https://travis-ci.org/petrohi/machine_gun.svg?branch=master)](https://travis-ci.org/petrohi/machine_gun)\n\n# MachineGun\n\nHTTP client for Elixir. Based on [Gun](https://github.com/ninenines/gun) and [Poolboy](https://github.com/devinus/poolboy).\n\n* Supports HTTP/1 and HTTP/2 with automatic detection;\n* Maintains separate connection pool for each pool_group:host:port combination;\n* Allows per-pool configuration;\n* Drop-in replacement for [HTTPoison](https://github.com/edgurgel/httpoison).\n\n## Example\n\n```\n%MachineGun.Response{body: body, status_code: 200} =\n  MachineGun.post!(\n    \"https://httpbin.org/anything\",\n    \"{\\\"hello\\\":\\\"world!\\\"}\",\n    [{\"content-type\", \"application/json\"}, {\"accept\", \"application/json\"}],\n    %{pool_timeout: 1000, request_timeout: 5000, pool_group: :default})\n```\n\nOptions are included to show defaults and can be omitted. `pool_timeout` and `request_timeout` default to values specified in pool group configuration. If not specified in pool group configuration they default to the values in the example.\n\n## Configuration\n\n```\nconfig :machine_gun,\n  # Default pool group\n  default: %{\n    pool_size: 4,         # Poolboy size\n    pool_max_overflow: 4, # Poolboy max_overflow\n    pool_timeout: 1000,\n    request_timeout: 5000,\n    conn_opts: %{}        # Gun connection options\n  }\n```\n\nConfiguration example shows defaults and can be omitted. See [Poolboy options](https://github.com/devinus/poolboy#options) documentation for explanation of  `pool_size` and `pool_max_overflow`. See [Gun manual](https://ninenines.eu/docs/en/gun/1.3/manual/gun/) for explanation of `conn_opts`.\n\n## Notes\n\n* When using MachineGun in a long-living process (for example genserver) make sure to handle messages in the form of `{ref, _}` tuples, which may be produced by pool [timeouts](https://hexdocs.pm/elixir/GenServer.html#call/3-timeouts).\n* When using MachineGun with HTTP/2 and modern HTTP/1 servers we recommend using lowercase header names. For example `content-type`.\n* MachineGun may timeout when request with empty body contains `content-type` header and does not contain `content-length` header. See [this issue](https://github.com/ninenines/gun/issues/141) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrohi%2Fmachine_gun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrohi%2Fmachine_gun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrohi%2Fmachine_gun/lists"}