当前位置:网站首页>Write an interface based on flask
Write an interface based on flask
2022-07-05 20:50:00 【vzhb】
background :
because et Item eating cookie For the crawler , I don't want to update manually cookie, So a cookie Thread pool . A cloud server is specialized in automatic production cookie, Then as an interface server , The other one is on the client get obtain cookie.
perhaps This method also works , Two servers share folders directly ,1 Yes 1 signal communication .
------------------------------- Cutting line ----------------------------------------
matters needing attention :
Set up ip And port number , And the public network of the server ip And port number open . The following intranet test .
Interface server :
from flask import Flask,request
import json
app=Flask(__name__)
# We only accept get Method access
@app.route("/test",methods=["GET"])
def check():
# Default return content
return_dict= {'return_code': '200', 'return_info': ' Handle a successful ', 'result': False}
# Judge whether the input parameter is empty
get_data=request.args.to_dict()
if ('name' not in get_data) or ('num' not in get_data):
return_dict['return_code'] = '5004'
return_dict['return_info'] = ' Request parameter error '
return json.dumps(return_dict, ensure_ascii=False)
# Get incoming params Parameters
name=get_data.get('name')
num=get_data.get('num')
# Operate on parameters
return_dict['result']=tt(name,num)
return json.dumps(return_dict, ensure_ascii=False)
# Function function
def tt(name,num):
result_str="%s apply %s individual cookie" %(name,num)
return result_str
if __name__ == "__main__":
#192.168.1.225
app.run(debug=False,host='0.0.0.0')client :
Web page direct get Take the return value . Pictured 1 Sum graph 2, They are null parameter and normal parameter respectively


among ip And port number can be set by yourself ,0.0.0.0 It's local ip
边栏推荐
- Abnova blood total nucleic acid purification kit pre installed relevant instructions
- Duchefa low melting point agarose PPC Chinese and English instructions
- 小程序全局配置
- 3.3 project evaluation
- CVPR 2022 | common 3D damage and data enhancement
- Kubernetes resource object introduction and common commands (V) - (configmap & Secret)
- XML建模
- Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang
- Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
- 解析创客教育的知识迁移和分享精神
猜你喜欢

Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang

2.8、项目管理过程基础知识

Abbkine丨TraKine F-actin染色试剂盒(绿色荧光)方案

台风来袭!建筑工地该如何防范台风!

Make Jar, Not War

Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral

解析创客教育的知识迁移和分享精神

Abnova丨荧光染料 620-M 链霉亲和素方案

教你自己训练的pytorch模型转caffe(一)

ProSci LAG3抗体的化学性质和应用说明
随机推荐
Redis唯一ID生成器的实现
CareerCup它1.8 串移包括问题
leetcode:1139. 最大的以 1 为边界的正方形
Duchefa细胞分裂素丨二氢玉米素 (DHZ)说明书
sql系列(基础)-第二章 限制和排序数据
当Steam教育进入个性化信息技术课程
[UE4] unrealinsight obtains the real machine performance test report
Duchefa丨P1001植物琼脂中英文说明书
挖财商学院给的证券账户安全吗?可以开户吗?
小程序事件绑定
Abnova CD81 monoclonal antibody related parameters and Applications
Use of form text box (II) input filtering (synthetic event)
ODPS 下一个map / reduce 准备
Propping of resources
Abnova丨DNA 标记高质量控制测试方案
Abnova丨CRISPR SpCas9 多克隆抗体方案
Norgen AAV extractant box instructions (including features)
MySQL InnoDB架构原理
表单文本框的使用(二) 输入过滤(合成事件)
Graph embedding learning notes