{"id":15689923,"url":"https://github.com/ido50/requests","last_synced_at":"2025-05-07T02:22:51.566Z","repository":{"id":46568015,"uuid":"135034657","full_name":"ido50/requests","owner":"ido50","description":"High-level, API-centric HTTP client for Go","archived":false,"fork":false,"pushed_at":"2024-07-31T12:53:24.000Z","size":64,"stargazers_count":8,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T02:11:35.822Z","etag":null,"topics":["api","api-client","go","golang","http","https","requests","rest","rest-api","restful"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ido50.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-27T10:00:51.000Z","updated_at":"2024-07-31T12:53:13.000Z","dependencies_parsed_at":"2024-06-18T20:05:48.418Z","dependency_job_id":"858c339c-ea0f-43f0-894d-2e2249164d30","html_url":"https://github.com/ido50/requests","commit_stats":{"total_commits":27,"total_committers":7,"mean_commits":3.857142857142857,"dds":0.4814814814814815,"last_synced_commit":"cd1283fb7ff5471503161af666c731851a735a1d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ido50%2Frequests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ido50%2Frequests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ido50%2Frequests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ido50%2Frequests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ido50","download_url":"https://codeload.github.com/ido50/requests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233315342,"owners_count":18657408,"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","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":["api","api-client","go","golang","http","https","requests","rest","rest-api","restful"],"created_at":"2024-10-03T18:05:08.280Z","updated_at":"2025-01-11T04:07:02.018Z","avatar_url":"https://github.com/ido50.png","language":"Go","readme":"\u003ch2 align=\"center\"\u003e\u003cstrong\u003erequests\u003c/strong\u003e\u003c/h2\u003e\n\u003cp align=\"center\"\u003ehigh-level HTTP client for Go.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://godoc.org/github.com/ido50/requests\"\u003e\u003cimg src=\"https://img.shields.io/badge/godoc-reference-blue.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://goreportcard.com/report/ido50/requests\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/ido50/requests\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ido50/requests/actions\"\u003e\u003cimg src=\"https://github.com/ido50/requests/workflows/build/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n`requests` is a high-level, API-centric HTTP client for Go projects. It is meant\nto provide a more comfortable mechanism to perform requests to HTTP APIs (rather\nthan making general requests), and to prevent common mistakes made when using\n`net/http` directly.\n\nWith `requests`, one must not need to remember to read HTTP responses in full (so\nGo can reuse TCP connections), nor to close response bodies. Handling of JSON\ndata - be it in requests or responses - is made easier by way of built-in\nencoders/decoders. An automatic retry mechanism is also included.\n\nThe library allows a \"DRY\" (Dont Repeat Yourself) approach to REST API usage by\nintroducing API-specific dependencies into the client object. For example,\nauthorization headers and response handlers can be set in the client object,\nand all generated requests will automatically include them.\n\n# Install\n\n```\ngo get -u github.com/ido50/requests\n```\n\n# Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/ido50/requests\"\n)\n\nconst apiURL = \"https://my.api.com/v2\"\n\ntype RequestBody struct {\n\tTitle   string   `json:\"title\"`\n\tTags    []string `json:\"tags\"`\n\tPublish bool     `json:\"publish\"`\n}\n\ntype ResponseBody struct {\n\tID   int64     `json:\"id\"`\n\tDate time.Time `json:\"date\"`\n}\n\nfunc main() {\n\tclient := requests.\n\t\tNewClient(apiURL).\n\t\tAccept(\"application/json\").\n\t\tBasicAuth(\"user\", \"pass\").\n\t\tRetryLimit(3)\n\n\tvar res ResponseBody\n\n\terr := client.\n\t\tNewRequest(\"POST\", \"/articles\").\n\t\tJSONBody(RequestBody{\n\t\t\tTitle:   \"Test Title\",\n\t\t\tTags:    []string{\"test\", \"stories\"},\n\t\t\tPublish: true,\n\t\t}).\n\t\tExpectedStatus(http.StatusCreated).\n\t\tInto(\u0026res).\n\t\tRun()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Created article %d on %s\\n\", res.ID, res.Date.Format(time.RFC3339))\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fido50%2Frequests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fido50%2Frequests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fido50%2Frequests/lists"}