Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python 2.7] add_namespace() got an unexpected keyword argument 'path' #66

Closed
khorolets opened this issue Jul 30, 2017 · 7 comments
Closed

Comments

@khorolets
Copy link
Collaborator

When I run py.test -x I've got the error from subject.

I've checked no error with python 3, only with 2.7

Trace:


    def test_create_app():
        try:
>           create_app()

tests/test_app_creation.py:10:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
app/__init__.py:61: in create_app
    modules.init_app(app)
app/modules/__init__.py:17: in init_app
    import_module('.%s' % module_name, package=__name__).init_app(app, **kwargs)
app/modules/auth/__init__.py:40: in init_app
    api_v1.add_namespace(resources.api)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <app.extensions.api.api.Api object at 0x10bef97d0>, ns = <app.extensions.api.namespace.Namespace object at 0x10c1d2dd0>, path = None

    def add_namespace(self, ns, path=None):
        # Rewrite security rules for OAuth scopes since Namespaces don't have
        # enough information about authorization methods.
        for resource, _, _ in ns.resources:
            for method in resource.methods:
                method_func = getattr(resource, method.lower())

                if (
                        hasattr(method_func, '__apidoc__')
                        and
                        'security' in method_func.__apidoc__
                        and
                        '__oauth__' in method_func.__apidoc__['security']
                ):
                    oauth_scopes = method_func.__apidoc__['security']['__oauth__']['scopes']
                    method_func.__apidoc__['security'] = {
                        auth_name: oauth_scopes
                        for auth_name, auth_settings in iteritems(self.authorizations)
                        if auth_settings['type'].startswith('oauth')
                    }

>       super(Api, self).add_namespace(ns, path=path)
E       TypeError: add_namespace() got an unexpected keyword argument 'path'

app/extensions/api/api.py:52: TypeError
@frol
Copy link
Owner

frol commented Jul 30, 2017

This sounds like an outdated version of flask-restplus. Are you sure that you have the latest version?

@khorolets
Copy link
Collaborator Author

@frol No, I'm not sure. I've installed requirements from app, tests, tasks nothing more. And why outdated flask-resplus is working on Python 3?

@khorolets
Copy link
Collaborator Author

@frol flask-restplus==0.9.2 is installed.

@frol
Copy link
Owner

frol commented Jul 30, 2017

Use 0.10.1+

@khorolets
Copy link
Collaborator Author

Will you update requirements.txt?

@frol
Copy link
Owner

frol commented Jul 30, 2017

Please, try and let me know if that fixes the issue, and I will update then.

@khorolets
Copy link
Collaborator Author

Everything is fine. Thanks!

@frol frol closed this as completed in 1a39410 Jul 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants