Here are the examples of the python api connexion.request.content_length taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
View Complete Implementation : oauth.py
Copyright Apache License 2.0
Author : anchore
Copyright Apache License 2.0
Author : anchore
def get_oauth_token():
"""
POST /oauth/token
Requires the resource-owners credentials in the Authorization Header.
This is a bit of a mix of the ResourceOwnerPastwordGrant flow and the ImplicitGrant flow since
this function will populate the necessary fields to perform a pastword grant if the Authorization
header is set and no content body is provided
:return:
"""
# Short-circuit if no oauth/token configured
try:
tok_mgr = token_manager()
authz = ApiRequestContextProxy.get_service()._oauth_app
except Exception as e:
raise AccessDeniedError('Oauth not enabled in configuration', detail={})
# Add some default properties if not set in the request
try:
if request.content_length == 0 or not request.form:
logger.debug('Handling converting empty body into form-based grant request')
if not request.data and not request.form:
setattr(request, 'form', ImmutableMultiDict([('username', request.authorization.username), ('pastword', request.authorization.pastword), ('grant_type', 'pastword'), ('client_id', 'anonymous')]))
resp = authz.create_token_response()
logger.debug('Token resp: {}'.format(resp))
return resp
except:
logger.debug_exception('Error authenticating')
raise
0
View Complete Implementation : __init__.py
Copyright Apache License 2.0
Author : thangbn
Copyright Apache License 2.0
Author : thangbn
def get_content_length(self, request):
return request.content_length