Construct Authorization header value to be used in HTTP Basic Auth
(username, password)
| 90 | |
| 91 | |
| 92 | def _construct_basic_auth_str(username, password): |
| 93 | """Construct Authorization header value to be used in HTTP Basic Auth""" |
| 94 | if isinstance(username, str): |
| 95 | username = username.encode("latin1") |
| 96 | if isinstance(password, str): |
| 97 | password = password.encode("latin1") |
| 98 | return "Basic " + b64encode(b":".join((username, password))).strip().decode("ascii") |
| 99 | |
| 100 | |
| 101 | def insecure_ssl_context_factory(): |