Belle II Software development
BearerAuth Class Reference
Inheritance diagram for BearerAuth:

Public Member Functions

def __init__ (self, token)
 
def __call__ (self, r)
 

Protected Attributes

 _authtoken
 Authorization header to send with each request.
 

Detailed Description

Simple class to present bearer token instead of username/password

Definition at line 122 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  token 
)
Construct from a token

Definition at line 125 of file __init__.py.

125 def __init__(self, token):
126 """Construct from a token"""
127
128 self._authtoken = f"Bearer {token}"
129

Member Function Documentation

◆ __call__()

def __call__ (   self,
  r 
)
Update headers to include token

Definition at line 130 of file __init__.py.

130 def __call__(self, r):
131 """Update headers to include token"""
132 r.headers["X-Authorization"] = self._authtoken
133 return r
134
135

Member Data Documentation

◆ _authtoken

_authtoken
protected

Authorization header to send with each request.

Definition at line 128 of file __init__.py.


The documentation for this class was generated from the following file: