diff --git a/docker/Dockerfile b/docker/Dockerfile index f86c68f..a27a532 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,4 +5,4 @@ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 禁用缓存减小体积 COPY . . EXPOSE 5000 -CMD ["python3","main.py"] \ No newline at end of file +CMD ["python3","./main.py"] \ No newline at end of file diff --git a/main.py b/main.py index 353d9de..4f55412 100644 --- a/main.py +++ b/main.py @@ -22,7 +22,6 @@ def init_scheduler(): def fetch(api): - """调用百度热搜 API (示例接口,需替换实际 API Key) [6](@ref)""" url = api[1]['url'] hotList = api[1]['hot'] random.shuffle(hotList) @@ -49,10 +48,12 @@ def get_random_hot_searches(): continue else: cache.add(hot['title']) - return {'code': 200, 'data': [hot]} + res = {'code': 200, 'data': [hot]} + print("返回热搜词"+str(hot['title'])) + return res return [{"title": "所有平台数据均重复或无数据", "source": "system"}] if __name__ == "__main__": # init_scheduler() - app.run(debug=True) + app.run(host="0.0.0.0", port="5000")