Add base URL to Digest auth password manager
Small fix to help urllib match credentials correctly by adding both the full RPC URL and base URL to the password manager. This may resolve Digest authentication issues with Monero wallet RPC.
This commit is contained in:
parent
4d0021ed91
commit
e8c4f5e879
1 changed files with 5 additions and 0 deletions
|
|
@ -45,7 +45,12 @@ class MoneroClient:
|
|||
if self.rpc_user and self.rpc_pass:
|
||||
# Create a password manager for Digest auth
|
||||
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
|
||||
# Add password for both the full URL and just the base URL
|
||||
password_mgr.add_password(None, self.rpc_url, self.rpc_user, self.rpc_pass)
|
||||
from urllib.parse import urlparse
|
||||
parsed = urlparse(self.rpc_url)
|
||||
base_url = f"{parsed.scheme}://{parsed.netloc}"
|
||||
password_mgr.add_password(None, base_url, self.rpc_user, self.rpc_pass)
|
||||
|
||||
# Create the Digest auth handler
|
||||
auth_handler = urllib.request.HTTPDigestAuthHandler(password_mgr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue