There was an error while loading. Please reload this page.
1 parent 537f600 commit 8fd8fe8Copy full SHA for 8fd8fe8
1 file changed
dsms/core/configuration.py
@@ -1,5 +1,6 @@
1
"""General config for the DSMS Python SDK"""
2
3
+import base64
4
import logging
5
import urllib
6
import warnings
@@ -296,7 +297,11 @@ def validate_auth(self):
296
297
)
298
elif username and passwd:
299
url = urllib.parse.urljoin(str(host_url), "api/users/token")
- authorization = f"Basic {username.get_secret_value()}:{passwd.get_secret_value()}" # pylint: disable=no-member
300
+ # FastAPI HTTPBasic requires base64-encoded credentials; old Flask endpoint accepted raw
301
+ _credentials = base64.b64encode(
302
+ f"{username.get_secret_value()}:{passwd.get_secret_value()}".encode() # pylint: disable=no-member
303
+ ).decode()
304
+ authorization = f"Basic {_credentials}"
305
logger.debug("Sending get request to %s", url)
306
response = requests.get(
307
url,
0 commit comments