Files
SmartUp/backend/test_upstream.py
T
liumangmang 7adc7c00ab Add remote browser pages and website sync
Enable managed remote browser custom pages with login autofill and add website sync workflows so external admin surfaces can be handled inside SmartUp.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:43:58 +08:00

37 lines
1.0 KiB
Python

import json
import sys
import logging
from app.services.upstream_client import UpstreamClient
logging.basicConfig(level=logging.DEBUG)
def main():
client = UpstreamClient(
base_url="http://170.106.100.210:55555",
api_prefix="",
auth_type="bearer",
auth_config={"token": ""}, # We don't have token, but /api/group/ in some new-api may be open, or fail with 401
timeout=10.0,
)
try:
groups = client.get_available_groups("/api/group/")
print("Groups:", groups)
except Exception as e:
print("Groups Error:", e)
try:
rates = client.get_group_rates("/api/option/?key=GroupRatio")
print("Rates:", rates)
except Exception as e:
print("Rates Error:", e)
try:
from app.services.upstream_client import _extract_rates_map, _unwrap_list
print("Unwrapped Groups:", _unwrap_list(groups))
print("Extracted Rates:", _extract_rates_map(rates))
except Exception as e:
pass
if __name__ == "__main__":
main()