Skip to main content

OpenAPI v3 parser

Project description

OpenAPI Parser

PyPI - Version PyPI - Downloads PyPI - Python Version PyPI - Format PyPI - License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tal_openapi3_parser-1.1.20.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tal_openapi3_parser-1.1.20-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file tal_openapi3_parser-1.1.20.tar.gz.

File metadata

  • Download URL: tal_openapi3_parser-1.1.20.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tal_openapi3_parser-1.1.20.tar.gz
Algorithm Hash digest
SHA256 7f733a0185405820d1b684ef7751ddd4d246027feec23f00a07558fab879a12c
MD5 b2612d536eaa0c593a195c64c66ee4f1
BLAKE2b-256 83d4e514801a16a1ed005234f1dd6a8b2dca959971d6abda9a10379e246d6f22

See more details on using hashes here.

File details

Details for the file tal_openapi3_parser-1.1.20-py3-none-any.whl.

File metadata

File hashes

Hashes for tal_openapi3_parser-1.1.20-py3-none-any.whl
Algorithm Hash digest
SHA256 8c9faf98b9cf04f6769900bb47234d616a86607cd108fdecb359ae1e5e2e65c9
MD5 b08d1043d18f24abea6de79076c8c2ad
BLAKE2b-256 5f4ea1717785b3795df189a20b281dab5421a34e18787b6b307f6ffa5d6e77e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page