Skip to content

Commit 06dcf7a

Browse files
committed
Updated docstrings of authentication related functions
1 parent 537874f commit 06dcf7a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

adafruit_httpserver/authentication.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def __str__(self) -> str:
4141
def check_authentication(request: Request, auths: List[Union[Basic, Bearer]]) -> bool:
4242
"""
4343
Returns ``True`` if request is authorized by any of the authentications, ``False`` otherwise.
44+
45+
Example::
46+
47+
check_authentication(request, [Basic("username", "password")])
4448
"""
4549

4650
auth_header = request.headers.get("Authorization")
@@ -56,6 +60,10 @@ def require_authentication(request: Request, auths: List[Union[Basic, Bearer]])
5660
Checks if the request is authorized and raises ``AuthenticationError`` if not.
5761
5862
If the error is not caught, the server will return ``401 Unauthorized``.
63+
64+
Example::
65+
66+
require_authentication(request, [Basic("username", "password")])
5967
"""
6068

6169
if not check_authentication(request, auths):

adafruit_httpserver/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def require_authentication(self, auths: List[Union[Basic, Bearer]]) -> None:
362362
Example::
363363
364364
server = Server(pool, "/static")
365-
server.require_authentication([Basic("user", "pass")])
365+
server.require_authentication([Basic("username", "password")])
366366
"""
367367
self._auths = auths
368368

0 commit comments

Comments
 (0)