hug icon indicating copy to clipboard operation
hug copied to clipboard

Apply requires to extend_api

Open Omniflux opened this issue 8 years ago • 3 comments

Is there currently a way to achieve this?

@hug.extend_api ('/backoffice', requires = token_key_authentication)
def extend_api_backoffice():
        import backoffice
        return (backoffice,)

or

hug_auth = hug.http (requires = token_key_authentication)
@hug_auth.extend_api ('/backoffice')
def extend_api_backoffice():
        import backoffice
        return (backoffice,)

Omniflux avatar Feb 25 '17 18:02 Omniflux

I would also like to know if there is a way to extend like that

wallb avatar Jun 14 '17 22:06 wallb

I am having the same question; I have one main API file in which I extend functionality with different files, by making use of the @hug.extend_api directive. I would like to secure this at the main API file, so I don't have to put in authentication in the other files.

nilsdebruin avatar Aug 30 '17 08:08 nilsdebruin

@timothycrosley, does 287933cab78652d0535ea5b93d87fa161e9feabe look correct to do this?

Omniflux avatar Dec 26 '18 03:12 Omniflux