From 993efda0a6a271c80eaa80a1798aeaa6ba8d53fc Mon Sep 17 00:00:00 2001 From: hackrobot Date: Thu, 18 Jul 2024 09:38:18 +0800 Subject: [PATCH] update --- main.py | 4 +++- test.py | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index c2739c8..2196dc2 100644 --- a/main.py +++ b/main.py @@ -48,4 +48,6 @@ async def send_message(request: Request): # 运行应用程序 if __name__ == "__main__": import uvicorn - uvicorn.run(app, host="0.0.0.0", port=8521) + # uvicorn.run(app, host="0.0.0.0", port=8521) + uvicorn.run(app, host="127.0.0.1", port=8521) + diff --git a/test.py b/test.py index d8d80bc..36e7030 100644 --- a/test.py +++ b/test.py @@ -2,9 +2,17 @@ import requests # url = "http://127.0.0.1:8000/send_message" url = "http://192.168.31.38:8521/send_message" +# url = "http://tg.yidooplanet.com/send_message" + data = {"message": "Hello, World!"} headers = {"Content-Type": "application/json"} response = requests.post(url, json=data, headers=headers) -print(response.json()) + +try: + response_data = response.json() + print(response_data) +except requests.exceptions.JSONDecodeError: + print("Response content is not in JSON format") + print("Response content:", response.text) \ No newline at end of file