flask-restful-swagger-2.0 icon indicating copy to clipboard operation
flask-restful-swagger-2.0 copied to clipboard

Error: securityDefinitions

Open sanjusci opened this issue 6 years ago • 0 comments

api = Api(
    app,
    errors=http_errors(),
    api_version='1.0.0',
    api_spec_url='/api/swagger',
    title='T',
    description='Api specifications T',
    contact={
        "name": "Sanju Sci",
        "email": "[email protected]",
        "url": "http://sanjusci.com"
      },
    host=SWAGGER_CONFIG.get('HOST', ""),
    schemes=[
        "http",
        "https",
    ],
    securityDefinitions={
        "Bearer": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    },
    consumes=[
        "application/json",
        'multipart/form-data'
    ],
    produces=[
        "application/json"
    ]
)
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1683, in <module>
    main()
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1677, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1087, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/sanju.sci/Documents/flask/app.py", line 54, in <module>
    "application/json"
  File "/Users/sanju.sci//Documents/lask/.env/lib/python3.6/site-packages/flask_restful_swagger_2/__init__.py", line 83, in __init__
    super(Api, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'securityDefinitions'

Error: when I define "securityDefinitions" in the configuration for Authorization.

sanjusci avatar Aug 24 '18 10:08 sanjusci