{"id":20895164,"url":"https://github.com/wy-z/requests-openapi","last_synced_at":"2025-04-22T15:21:17.085Z","repository":{"id":55155802,"uuid":"188546010","full_name":"wy-z/requests-openapi","owner":"wy-z","description":"A lightweight but powerful and easy-to-use Python client library for OpenAPI v3.","archived":false,"fork":false,"pushed_at":"2024-05-30T08:34:10.000Z","size":38,"stargazers_count":65,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T16:54:16.576Z","etag":null,"topics":["openapi","openapi3","pydantic","requests"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wy-z.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":"2019-05-25T09:22:34.000Z","updated_at":"2025-03-10T07:28:39.000Z","dependencies_parsed_at":"2024-01-18T12:27:40.559Z","dependency_job_id":"a0f0e959-fd63-454e-ada9-3d6a2bfffc53","html_url":"https://github.com/wy-z/requests-openapi","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.07999999999999996,"last_synced_commit":"c675022fe895246ee9a545d717088fcfb48f8568"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wy-z%2Frequests-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wy-z%2Frequests-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wy-z%2Frequests-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wy-z%2Frequests-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wy-z","download_url":"https://codeload.github.com/wy-z/requests-openapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249304988,"owners_count":21247955,"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":["openapi","openapi3","pydantic","requests"],"created_at":"2024-11-18T10:25:29.452Z","updated_at":"2025-04-22T15:21:15.975Z","avatar_url":"https://github.com/wy-z.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# requests-openapi\n\n[![image](https://img.shields.io/pypi/v/requests-openapi.svg)](https://pypi.org/project/requests-openapi/)\n[![image](https://img.shields.io/pypi/l/requests-openapi.svg)](https://pypi.org/project/requests-openapi/)\n[![image](https://img.shields.io/pypi/pyversions/requests-openapi.svg)](https://pypi.org/project/requests-openapi/)\n[![image](https://raw.githubusercontent.com/wy-z/requests-openapi/master/tests/coverage-badge.svg)](https://github.com/wy-z/requests-openapi)\n\nA lightweight but powerful and easy-to-use Python client library for OpenAPI v3.\n\n## Key Features\n\n- **Lightweight Design**: Experience a minimalistic interface.\n- **Focus on Essentials**: Helps you simplify the handling of Paths, Parameters, Headers, Cookies, etc., while inheriting all the capabilities of Requests.\n- **Testing and Integration Made Easy**: Whether you're running tests or integrating with other systems, the client simplifies these tasks.\n\n## Usage\n\n```python\nimport requests_openapi\n\n# load spec from url\nc = requests_openapi.Client().load_spec_from_url(\"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml\")\n# or load from file\nc = requests_openapi.Client().load_spec_from_file(\"openapi.json\")\n# set server\nc.set_server(requests_openapi.Server(url=\"https://fake.com/api\"))\n\n# custom session for auth or others\nc.requestor # a instance of requests.Session, see https://requests.readthedocs.io/en/latest/user/advanced/#session-objects\n# set update token\nc.requestor.headers.update({\"Authorization\": \"token\"})\n\n# call api by operation id\nresp = c.listPets() # resp: requests.Response\nresp.json()\n# get by path id\nresp = c.showPetById(petId=1)\nresp.json()\n# post\nresp = c.createPets(json={})\nresp.json()\n\n#\n# Advanced Usage\n#\n\n# set req options, 'req_opts' param to custom request options\nrequests_openapi.Client(req_opts={\"timeout\": 60}).load_spec_from_file(\"xx\")\n\n# parameters starts with '_' or not found in openapi spec, will be passed through to the requesting\nc.createPets(json={}, _headers={}, _params={}, _cookies={})\n\n# parameters\n# in: cookie, name: csrftoken\nc.createPets(csrftoken=\"***\")\n# in: header, name: x-foo\nc.createPets(**{\"x-foo\": \"***\"})\n# in: path, name: userId\nc.getUser(userId=1)\n# in: query, name: offset\nc.listUsers(offset=1)\n\n# http body, just like requests.Session\nc.createPets(json={}) or c.createPets(data={})\n```\n\n## Installation\n\n```\npip install requests-openapi\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwy-z%2Frequests-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwy-z%2Frequests-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwy-z%2Frequests-openapi/lists"}