当前位置:网站首页>Écrire une interface basée sur flask
Écrire une interface basée sur flask
2022-07-05 20:50:00 【Vzhb】
Contexte:
Parce queetProjet à mangercookieRamper,Je ne veux pas mettre à jour manuellementcookie,Il a créé uncookiePool de Threads.Un serveur Cloud dédié à la production automatiséecookie,Puis comme serveur d'interface,L'autre sur le clientgetAccèscookie.
Ou Cette méthode fonctionne aussi,Deux serveurs partagent directement des dossiers,1C'est exact.1Communications.
-------------------------------Ligne de coupe----------------------------------------
Notes:
ParamètresipEt le numéro de port,Et le réseau public du serveuripEt le numéro de port ouvert.Test Intranet ci - dessous.
Serveur d'interface:
from flask import Flask,request
import json
app=Flask(__name__)
# Acceptez seulementgetAccès aux méthodes
@app.route("/test",methods=["GET"])
def check():
# Contenu de retour par défaut
return_dict= {'return_code': '200', 'return_info': 'Traitement réussi', 'result': False}
# Déterminer si le paramètre d'entrée est vide
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'] = 'Mauvais paramètre de requête'
return json.dumps(return_dict, ensure_ascii=False)
# Obtenir lesparamsParamètres
name=get_data.get('name')
num=get_data.get('num')
# Fonctionnement des paramètres
return_dict['result']=tt(name,num)
return json.dumps(return_dict, ensure_ascii=False)
# Fonctions fonctionnelles
def tt(name,num):
result_str="%sApplication%s- Oui.cookie" %(name,num)
return result_str
if __name__ == "__main__":
#192.168.1.225
app.run(debug=False,host='0.0.0.0')
Client:
Web direct getPrenez la valeur de retour.Comme le montre la figure1Et des graphiques2, NULL et paramètres normaux, respectivement
Parmi euxip Et les numéros de port peuvent être définis par eux - mêmes ,0.0.0.0C'est la machine.ip
边栏推荐
- 【UE4】UnrealInsight获取真机性能测试报告
- The development of research tourism practical education helps the development of cultural tourism industry
- Norgen AAV提取剂盒说明书(含特色)
- Is the securities account given by the school of Finance and business safe? Can I open an account?
- Abnova丨CRISPR SpCas9 多克隆抗体方案
- 产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
- CareerCup它1.8 串移包括问题
- Is it safe to open a stock account by mobile phone? My home is relatively remote. Is there a better way to open an account?
- Which securities is better for securities account opening? Is online account opening safe?
- 培养机器人教育创造力的前沿科技
猜你喜欢
Duchefa丨P1001植物琼脂中英文说明书
Kubernetes resource object introduction and common commands (V) - (configmap & Secret)
When steam education enters personalized information technology courses
leetcode:1755. 最接近目标值的子序列和
2.8 basic knowledge of project management process
haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)
Duchefa丨S0188盐酸大观霉素五水合物中英文说明书
Abnova丨血液总核酸纯化试剂盒预装相关说明书
小程序事件绑定
10000+ 代码库、3000+ 研发人员大型保险集团的研发效能提升实践
随机推荐
Applet global configuration
Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
ts 之 属性的修饰符public、private、protect
Abbkine BCA法 蛋白质定量试剂盒说明书
Codeforces Round #804 (Div. 2) - A, B, C
Duchefa p1001 plant agar Chinese and English instructions
Abnova CRISPR spcas9 polyclonal antibody protocol
重上吹麻滩——段芝堂创始人翟立冬游记
[UE4] unrealinsight obtains the real machine performance test report
CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)
获取前一天的js(时间戳转换)
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
Propping of resources
Applet page navigation
ODPS 下一个map / reduce 准备
教你自己训练的pytorch模型转caffe(一)
序列联配Sequence Alignment
Abnova total RNA Purification Kit for cultured cells Chinese and English instructions
证券开户选择哪个证券比较好?网上开户安全么?
Hongmeng OS' fourth learning