提交 a9e011a0 编写于 作者: H hjdhnx

初始化文件

上级 cbfcf018
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : app.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/8/25
from flask import Flask, jsonify, abort,request,redirect,make_response,render_template
import sys
import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
app = Flask(__name__)
app.config["JSON_AS_ASCII"] = False # jsonify返回的中文正常显示
MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'
PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
UA = 'Mozilla/5.0'
headers = {
'Referer': 'https://www.baidu.com',
'user-agent': UA,
}
@app.route('/')
def forbidden(): # put application's code here
abort(403)
@app.route('/index')
def index(): # put application's code here
return render_template('index.html')
if __name__ == '__main__':
app.run(host="0.0.0.0", port=9000)
\ No newline at end of file
# 这是一个示例 Python 脚本。
# 按 Shift+F10 执行或将其替换为您的代码。
# 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。
def print_hi(name):
# 在下面的代码行中使用断点来调试脚本。
print(f'Hi, {name}') # 按 Ctrl+F8 切换断点。
# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
print_hi('PyCharm')
# 访问 https://www.jetbrains.com/help/pycharm/ 获取 PyCharm 帮助
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>dr_py首页</title>
</head>
<body>
<h1>欢迎使用dr_py项目</h1>
<p>可以简单的自定义爬虫实现cms数据接口</p>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册