hololinked.client.security.BasicSecurity
Bases: BaseModel
Basic Security Scheme with username and password.
The credentials are added into the Authorization header. Normally, you can instantiate this indirectly through the
ClientFactory by passing username and password parameters, if the protocol supports it.
client = ClientFactory.http(
url="http://localhost:9000/my-thing/resources/wot-td",
security=BasicSecurity(
username=os.getenv("USERNAME", "admin"),
password=os.getenv("PASSWORD", "adminpass"),
base64_encoding=True
)
)
Source code in repo/hololinked/hololinked/client/security.py
Attributes
http_header
property
Value for the Authorization header.
Contains the credentials prefixed with Basic, if necessary with base64 encoding.
Functions
__init__
Initialize BasicSecurity with username and password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The username for basic authentication |
required |
|
str
|
The password for basic authentication |
required |
|
bool
|
Whether to encode the credentials in base64, by default True |
True
|