Added token property to request object.
This commit is contained in:
parent
6cf3754051
commit
986b0aa106
|
@ -72,6 +72,17 @@ class Request(dict):
|
||||||
|
|
||||||
return self.parsed_json
|
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
|
@property
|
||||||
def form(self):
|
def form(self):
|
||||||
if self.parsed_form is None:
|
if self.parsed_form is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user