Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-indyk committed Oct 26, 2018
1 parent c26786f commit 0737420
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions connexion/decorators/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def get_bearerinfo_func(security_definition):
return get_function_from_name(func)
return None


def security_passthrough(function):
"""
:type function: types.FunctionType
Expand Down
7 changes: 4 additions & 3 deletions connexion/operations/secure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from ..decorators.decorator import (BeginOfRequestLifecycleDecorator,
EndOfRequestLifecycleDecorator)
from ..decorators.security import (get_apikeyinfo_func, get_basicinfo_func,
get_bearerinfo_func,
get_scope_validate_func, get_tokeninfo_func,
security_deny, security_passthrough,
verify_apikey, verify_basic, verify_oauth,
verify_security, get_bearerinfo_func, verify_bearer)
verify_apikey, verify_basic, verify_bearer,
verify_oauth, verify_security)

logger = logging.getLogger("connexion.operations.secure")

Expand Down Expand Up @@ -128,7 +129,7 @@ def security_decorator(self):
logger.warning("... Unsupported http authorization scheme %s" % scheme, extra=vars(self))

elif security_scheme['type'] == 'apiKey':
scheme = security_scheme.get('x-authentication-scheme','').lower()
scheme = security_scheme.get('x-authentication-scheme', '').lower()
if scheme == 'bearer':
bearer_info_func = get_bearerinfo_func(security_scheme)
if not bearer_info_func:
Expand Down
2 changes: 1 addition & 1 deletion connexion/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def resolve_operation_id_using_rest_semantics(self, operation):
:type operation: connexion.operations.AbstractOperation
"""
path_match = re.search(
'^/?(?P<resource_name>([\w\-](?<!/))*)(?P<trailing_slash>/*)(?P<extended_path>.*)$', operation.path
r'^/?(?P<resource_name>([\w\-](?<!/))*)(?P<trailing_slash>/*)(?P<extended_path>.*)$', operation.path
)

def get_controller_name():
Expand Down
2 changes: 1 addition & 1 deletion connexion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def loads(self, data):

try:
return self.json.loads(data)
except Exception as error:
except Exception:
if isinstance(data, six.string_types):
return data

Expand Down
8 changes: 4 additions & 4 deletions examples/openapi3/jwt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
'''
Basic example of a resource server
'''
from werkzeug.exceptions import Unauthorized

import connexion

import time

from jose import jwt, JWTError
import connexion
from werkzeug.exceptions import Unauthorized

from jose import JWTError, jwt

JWT_ISSUER = 'com.zalando.connexion'
JWT_SECRET = '872f65270a71ca913766335276fb2c1b76b8ccdef749cdfc9a1598ac36d77c99'
Expand Down
3 changes: 1 addition & 2 deletions tests/fakeapi/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ def apikey_info(apikey, required_scopes=None):
return None

def jwt_info(token):
print(token)
if token == '100':
return {'sub': '100'}
return None
return None

0 comments on commit 0737420

Please sign in to comment.