from aws_lambda_powertools.event_handler.openapi.models import ( HTTPBearer, Server, ) from aws_lambda_powertools.event_handler.openapi.swagger_ui.html import ( generate_swagger_html, ) from app import app title = 'EDUSEGĀ® Public API' swagger_base_url = 'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.20.1' if __name__ == '__main__': spec = app.get_openapi_json_schema( servers=[Server(url='https://api.saladeaula.digital/v2')], title=title, security_schemes={'bearerAuth': HTTPBearer()}, security=[{'bearerAuth': []}], ) body = generate_swagger_html( spec=spec, swagger_base_url=swagger_base_url, swagger_js=f'{swagger_base_url}/swagger-ui-bundle.js', swagger_css=f'{swagger_base_url}/swagger-ui.css', oauth2_config=None, persist_authorization=True, ) with open('swagger/index.html', 'w') as fp: fp.write(body)