Merge pull request #236 from seanpar203/token_property

Add token property to request
This commit is contained in:
Eli Uriegas
2016-12-31 13:21:12 -06:00
committed by GitHub
2 changed files with 29 additions and 0 deletions

View File

@@ -72,6 +72,17 @@ class Request(dict):
return self.parsed_json
@property
def token(self):
"""
Attempts to return the auth header token.
:return: token related to request
"""
auth_header = self.headers.get('Authorization')
if auth_header is not None:
return auth_header.split()[1]
return auth_header
@property
def form(self):
if self.parsed_form is None: