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

Public Member Functions

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

Protected Attributes

str _authtoken = f"Bearer {token}"
 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__()

__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__()

__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

str _authtoken = f"Bearer {token}"
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: