kboss/b/capital/update_bandwidth.dspy
2025-07-16 14:27:17 +08:00

28 lines
979 B
Plaintext

async def update_bandwidth(ns={}):
import aiohttp
NETWORK_URL = 'http://cdsapi.capitalonline.net/vpc'
action = 'UpdateBandwidth'
method = "POST"
param = {}
url = get_signature(action, method, NETWORK_URL, param=param)
body = {
"BandwidthId": ns.get("BandwidthId"),
"Qos": ns.get("Qos"),
}
async with aiohttp.ClientSession() as session:
async with session.request(method, url, json=body) as response:
resp = await response.text()
result = json.loads(resp)
if result['Code'] == 'Success':
result['status'] = True
result.pop('Code')
result['data'] = result.pop('Data')
result['msg'] = result.pop('Message')
else:
result['status'] = False
result['msg'] = result.pop('Message')
return result
ret = await update_bandwidth(params_kw)
return ret