#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import sys import traceback sys.path.insert(0, 'ruoyi-fastapi-backend') import httpx async def test(): async with httpx.AsyncClient() as client: # 登录 login_resp = await client.post( "http://localhost:9099/login", data={"username": "admin", "password": "admin123"} ) token = login_resp.json()["data"]["token"] print(f"Token: {token[:20]}...") # 调用详情接口 headers = {"Authorization": f"Bearer {token}"} try: resp = await client.get( "http://localhost:9099/warehouse/receipt/685", headers=headers ) print(f"Status: {resp.status_code}") print(f"Response: {resp.text}") except Exception as e: print(f"Error: {e}") traceback.print_exc() asyncio.run(test())