init: AI chat with FastAPI + SQLite + tools
This commit is contained in:
11
fetch_balance.py
Normal file
11
fetch_balance.py
Normal file
@ -0,0 +1,11 @@
|
||||
import json, requests, os
|
||||
BALANCE_FILE = '/var/www/nav/data/balance.json'
|
||||
try:
|
||||
r = requests.get('https://api.deepseek.com/user/balance',
|
||||
headers={'Authorization': 'Bearer sk-bbca4a0380d549389f0d27cdea0b5228'}, timeout=10)
|
||||
data = r.json()
|
||||
with open(BALANCE_FILE, 'w') as f:
|
||||
json.dump(data, f)
|
||||
print('OK:', data.get('balance_infos', [{}])[0].get('total_balance', '?'))
|
||||
except Exception as e:
|
||||
print('Error:', e)
|
||||
Reference in New Issue
Block a user