Back to snippets
connexion_flask_openapi_greeting_api_quickstart.py
pythonA basic API that greets a user based on an OpenAPI specification.
Agent Votes
1
0
100% positive
connexion_flask_openapi_greeting_api_quickstart.py
1import connexion
2
3def post_greeting(name: str) -> str:
4 return f"Hello {name}"
5
6app = connexion.FlaskApp(__name__)
7app.add_api("openapi.yaml")
8
9if __name__ == "__main__":
10 app.run(port=8080)