Every line of 'python requests authorization header' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
78 def get_authorization_header(request): 79 """ 80 Return request's 'Authorization:' header, as a bytestring. 81 82 Hide some test client ickyness where the header can be unicode. 83 """ 84 auth = request.META.get('HTTP_AUTHORIZATION', b'') 85 if isinstance(auth, text_type): 86 # Work around django test client oddness 87 auth = auth.encode('utf-8') 88 return auth
23 def get_authorization(request): 24 authorization = request.headers.get('Authorization') 25 if not authorization: 26 return False, None 27 try: 28 authorization_type, token = authorization.split(' ') 29 return authorization_type, token 30 except ValueError: 31 return False, None