Add properties for Basic and Bearer Authorization values
Committed 3b3b51
--- a/web/headers/request.py
+++ b/web/headers/request.py
# XXX import configparser
# XXX import os
+import base64
import re
import httpagentparser
""""""
def __str__(self):
+ if self.header.startswith("Basic "):
+ return self.basic
+ elif self.header.startswith("Bearer "):
+ return self.bearer
+
+ @property
+ def basic(self):
+ return base64.b64decode(self.header.removeprefix("Basic ")).decode()
+
+ @property
+ def bearer(self):
return self.header.removeprefix("Bearer ")
_meta = ""