fix Basic auth bug
Browse files- src/libs/rpc_client.py +6 -2
src/libs/rpc_client.py
CHANGED
|
@@ -29,9 +29,13 @@ async def rpc_call(
|
|
| 29 |
"""
|
| 30 |
headers = {
|
| 31 |
'Content-Type': 'application/json',
|
| 32 |
-
"Authorization": os.getenv('CHATXBT_RPC_SERVER_BASIC_AUTH_CREDENTIALS')
|
| 33 |
}
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
payload = {
|
| 36 |
'method': method_name,
|
| 37 |
'params': params,
|
|
@@ -41,7 +45,7 @@ async def rpc_call(
|
|
| 41 |
|
| 42 |
try:
|
| 43 |
async with httpx.AsyncClient() as client:
|
| 44 |
-
response = await client.post(url, json=payload, headers=headers)
|
| 45 |
response.raise_for_status()
|
| 46 |
return response.json()
|
| 47 |
except httpx.RequestError as e:
|
|
|
|
| 29 |
"""
|
| 30 |
headers = {
|
| 31 |
'Content-Type': 'application/json',
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
+
auth = httpx.BasicAuth(
|
| 35 |
+
username=os.getenv('CHATXBT_RPC_SERVER_BASIC_AUTH_USERNAME'),
|
| 36 |
+
password=os.getenv('CHATXBT_RPC_SERVER_BASIC_AUTH_PASSWORD')
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
payload = {
|
| 40 |
'method': method_name,
|
| 41 |
'params': params,
|
|
|
|
| 45 |
|
| 46 |
try:
|
| 47 |
async with httpx.AsyncClient() as client:
|
| 48 |
+
response = await client.post(url, json=payload, headers=headers, auth=auth)
|
| 49 |
response.raise_for_status()
|
| 50 |
return response.json()
|
| 51 |
except httpx.RequestError as e:
|