37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
import json
|
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from app.database import SessionLocal
|
|
from app.models.website import Website
|
|
from app.routers.websites import _client
|
|
|
|
db = SessionLocal()
|
|
try:
|
|
website = db.query(Website).filter(Website.id == 2).first()
|
|
if not website:
|
|
print("Error: website wangwang888 (id=2) not found!")
|
|
sys.exit(1)
|
|
|
|
print(f"Loaded website: {website.name}, URL: {website.base_url}")
|
|
|
|
with _client(website) as c:
|
|
accounts = c.list_accounts()
|
|
acc = next((a for a in accounts if str(c.extract_id(a)) == "935"), None)
|
|
if not acc:
|
|
print("Error: Account 935 not found on remote site!")
|
|
sys.exit(1)
|
|
|
|
print(f"Found account 935: {acc.get('name')}, current platform: {acc.get('platform')}")
|
|
|
|
res = c.update_account("935", {"platform": "anthropic"})
|
|
print(f"Update response: {res}")
|
|
|
|
accounts_new = c.list_accounts()
|
|
acc_new = next((a for a in accounts_new if str(c.extract_id(a)) == "935"), None)
|
|
print(f"Verified account 935: {acc_new.get('name')}, new platform: {acc_new.get('platform')}")
|
|
finally:
|
|
db.close()
|