OpenAPI v3 parser
Project description
OpenAPI Parser
A simple package to parse your OpenAPI 3 documents into Python object to work with.
Supported versions:
| Version | Status |
|---|---|
| 2.0 | Deprecated |
| 3.0 | Supported |
| 3.1 | In development |
How to install
To install package run the following command
pip install openapi3-parser
How to use
Example of parser usage
>>> from openapi_parser import parse
>>> content = parse('swagger.yml')
>>> print(content)
Get application servers
from openapi_parser import parse
specification = parse('data/swagger.yml')
print("Application servers")
for server in specification.servers:
print(f"{server.description} - {server.url}")
# Output
#
# >> Application servers
# >> production - https://users.app
# >> staging - http://stage.users.app
# >> development - http://users.local
Get list of application URLs
from openapi_parser import parse
specification = parse('tests/data/swagger.yml')
urls = [x.url for x in specification.paths]
print(urls)
# Output
#
# >> ['/users', '/users/{uuid}']
Get operation with supported HTTP methods
from openapi_parser import parse
specification = parse('tests/data/swagger.yml')
for path in specification.paths:
supported_methods = ','.join([x.method.value for x in path.operations])
print(f"Operation: {path.url}, methods: {supported_methods}")
# Output
#
# >> Operation: /users, methods: get,post
# >> Operation: /users/{uuid}, methods: get,put
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openapi3_parser-1.1.22.tar.gz.
File metadata
- Download URL: openapi3_parser-1.1.22.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
080af74e80af76e68f181e398799e577f0a76492a7b569fa755ed4e4f4f86e1b
|
|
| MD5 |
7e1b09be15cc2c486f770c060204c3bc
|
|
| BLAKE2b-256 |
060af0a109e591cc0c7e1ae510458509e0a2a74b03afeca12b586adb4957aa46
|
File details
Details for the file openapi3_parser-1.1.22-py3-none-any.whl.
File metadata
- Download URL: openapi3_parser-1.1.22-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
591dedd06711059e10fdbee32301f1353b00d95958fbd910ea1de3e9e4d08b0c
|
|
| MD5 |
c801ff35131ed2c60814a10e0ccb75fa
|
|
| BLAKE2b-256 |
a5c541abc813aa29689a11b1ee7f262de583b4f56e7115c0e197a15f8c5c7a51
|