{"id":16170661,"url":"https://github.com/wardpearce/obrequests","last_synced_at":"2025-08-21T07:31:58.833Z","repository":{"id":46574804,"uuid":"275982148","full_name":"WardPearce/OBRequests","owner":"WardPearce","description":"Modern typed requests for Python 3 built on-top of HTTPX","archived":true,"fork":false,"pushed_at":"2022-05-13T08:20:45.000Z","size":264,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"Development","last_synced_at":"2025-03-01T21:17:33.549Z","etag":null,"topics":["async","asyncio","awaiting","based","http","https","object","python","requests","rest","sync","type","typed"],"latest_commit_sha":null,"homepage":"https://obrequests.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WardPearce.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":"2020-06-30T02:59:43.000Z","updated_at":"2024-12-22T15:08:28.000Z","dependencies_parsed_at":"2022-09-10T11:42:26.247Z","dependency_job_id":null,"html_url":"https://github.com/WardPearce/OBRequests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WardPearce/OBRequests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardPearce%2FOBRequests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardPearce%2FOBRequests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardPearce%2FOBRequests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardPearce%2FOBRequests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WardPearce","download_url":"https://codeload.github.com/WardPearce/OBRequests/tar.gz/refs/heads/Development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardPearce%2FOBRequests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271444087,"owners_count":24760714,"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-08-21T02:00:08.990Z","response_time":74,"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":["async","asyncio","awaiting","based","http","https","object","python","requests","rest","sync","type","typed"],"created_at":"2024-10-10T03:19:19.661Z","updated_at":"2025-08-21T07:31:58.599Z","avatar_url":"https://github.com/WardPearce.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Object-Based Requests\nObject-Based Requests reinvents the wheel around how HTTP requests are interfaced by developers, its built around reusability \u0026 static typing.\n\n## Index\n- [Install](#install)\n- [Docs](#docs)\n- [Features](#features)\n- [Example](#example)\n    - [Project example](/example)\n- [Thanks to](#thanks-to)\n\n## Install\n`pip3 install OBRequests\u003e=2.0.0`\n\n## Docs\n[obrequests.readthedocs.io](https://obrequests.readthedocs.io/en/latest/)\n\n## Features\n- Unique route typing\n- Documented\n- Supports sync \u0026 async with a flick of a boolean\n- Built on top of [HTTPX](https://github.com/encode/httpx) for stability and security.\n    - Supports all the amazing [features](https://github.com/encode/httpx#features) of HTTPX\n\n## Example\n```py\nfrom OBRequests import (\n    OBRequests, Response, CallBack, Route,\n    Get, json, raise_for_status,\n    HTTPStatusError, AnyStatus, BasicAuth\n)\n\n\ndef custom_response(resp: Response, is_get: bool = False,\n                    **kwargs) -\u003e None:\n    if is_get:\n        print(resp.status_code)\n    else:\n        raise NotImplementedError()\n\n\nclass Requests(OBRequests):\n    posts_route = Route(\n        \"/posts/{post_id}\",\n        responses={\n            AnyStatus: CallBack(raise_for_status)\n        },\n        path_params={\n            \"post_id\": \"404_error\"\n        },\n        methods=[\n            Get(\n                responses={\n                    200: CallBack(custom_response, is_get=True),\n                    201: ConditionalCallBack(\n                        awaiting=CallBack(custom_response, is_get=True),\n                        blocking=CallBack(custom_response, is_get=False)\n                    )\n                },\n                auth=BasicAuth(\"different\", \"password\")\n            ),\n        ],\n        auth=BasicAuth(\"username\", \"password\")\n    )\n\n\nrequest = Requests(\n    responses={\n        200: CallBack(json)\n    },\n    base_url=\"https://jsonplaceholder.typicode.com\",\n    awaiting=False,\n    globals_={\n        \"example\": True\n    }\n)\n\ntry:\n    request.posts_route.get()\n    # The same as\n    request.base_.get(url=\"/posts\")\nexcept HTTPStatusError as error:\n    print(error)\n\n# Prints status code\nrequest.posts_route.get(path_params={\n    \"post_id\": 1\n})\n\n\n# Only needed for async\nrequest.close_()\n```\n\n## Thanks to\n- [HTTPX](https://github.com/encode/httpx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardpearce%2Fobrequests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwardpearce%2Fobrequests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardpearce%2Fobrequests/lists"}