1 Star 0 Fork 1

jackssybin/微博登陆(含验证码)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
run.py 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
wj 提交于 2019-01-20 22:19 . weibo_login
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "ChenRenJian"
# Date: 2019/1/18
import os
from flask import request
from flask_restful import Resource, Api
import flask_cors
from werkzeug.contrib.fixers import ProxyFix
from flask import Flask
'''
微博登录----含验证码----输出cookie
接口:127.0.0.1:5000/?user=jdfdsf&password=dfsdfa
'''
from login import main
app = Flask(__name__) ##实例化app对象
flask_cors.CORS(app, supports_credentials=True) # 局域网访问
app.config.update(RESTFUL_JSON=dict(ensure_ascii=False)) ##传参存在中文的处理
api = Api(app)
class Lyric(Resource):
def get(self):
response = {}
user = request.args.get('user')
password = request.args.get('password')
try:
lrc = main(user, password)
if lrc:
response['success'] = True
response['cookie'] = lrc
else:
response['success'] = False
response['errorText'] = '二维码识别错误'
return response
except Exception as e:
response['success'] = False
response['err'] = str(e)
response['errorText'] = '获取cookie识别'
return response
api.add_resource(Lyric, '/')
if __name__ == '__main__':
#test()
#http://127.0.0.1:5000/?user=18649714783&password=jing12356
app.wsgi_app = ProxyFix(app.wsgi_app)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
app.run(host='127.0.0.1', port=5000, debug=True)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/jackssy/weibo_login.git
git@gitee.com:jackssy/weibo_login.git
jackssy
weibo_login
微博登陆(含验证码)
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385