feat: 添加多个日志文件以记录应用程序的运行信息和错误
This commit is contained in:
parent
3eb50cf270
commit
54347c12a8
@ -3,8 +3,6 @@ from flask import Flask, request, jsonify
|
||||
from DB import DBVidcon
|
||||
|
||||
app = Flask(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
endpoint = "https://api.dailymotion.com/videos"
|
||||
DEFAULT_PAGE = 1
|
||||
@ -33,13 +31,11 @@ def get_videos():
|
||||
}
|
||||
|
||||
try:
|
||||
logger.info("DM 请求 params=%s proxies=%s", params, proxy_string)
|
||||
resp = requests.get(endpoint, params=params, proxies=proxies, timeout=10)
|
||||
resp.raise_for_status()
|
||||
jd = resp.json()
|
||||
return jsonify(jd), 200
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error("DM 请求失败: %s", e)
|
||||
return jsonify({"status": "error", "msg": str(e)}), 502
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user