惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - kobe

.Net Razor Ajax Post Get处理 .net 7 session支持 windows redis常用 GO语言Windows安装和VScode配置 ASP.NET CORE 托管IIS第一次访问慢 .netcore发布托管IIS后 swagger显示404 dotnet run .net core web html中午查看源码显示乱码 centos netcore开机启动 NetCore Razor 路由伪静态设置 net core 6.0 session支持,非controller引用session net core web项目(net 6.0)增加apicontroller JPush,Jverify,JCore Ios冲突 apiRecord:methodName service mysqld restart 无效 Python log Windows下删除.svn文件夹 C# LINQ list遍历并组装返回新查询 windows server 2016下360wifi安装 Python获取本机多IP并指定出口IP
Python Flask+Windows Service制作
kobe · 2021-12-08 · via 博客园 - kobe
#安装pywin32
pip install pywin32

#安装服务
> python WinPyServiceExample.py install
Installing service WinPyServiceExample
Service installed

#更新服务
> python WinPyServiceExample.py update
Changing service configuration
Service updated

#查看服务
mmc Services.msc

#停止服务
> net stop PythonCornerExample

#仍旧存在问题,输入下列命令调试
python WinPyServiceExample.py debug

#常见问题
a. 检查Python执行路径是否在PATH变量中。可以在命令行窗口,输入python来确认。

b. 确认 C:\Program Files\Python36\Lib\site-packages\win32\pywintypes36.dll 存在(注意: “36” 是指python安装版本)。如果这个文件不存在,从C:\Program Files\Python36\Lib\site-packages\pywin32_system32\pywintypes36.dll 拷贝到上述目录下。

WinPyServiceExample.py
""" 
PythonCornerExample.py
"""

import time
import random
from pathlib import Path
from Winservice import Winservice
from flask import Flask, request, json
from gevent.pywsgi import WSGIServer
from HttpApi import app
import Config

class PythonCornerExample(Winservice):
_svc_name_ = "PyHttpService"
_svc_display_name_ = "PythonHttp服务"
_svc_description_ = "PythonHttp服务"

def start(self):
self.isrunning = True

def stop(self):
self.isrunning = False

def main(self):
#app.run(host="127.0.0.1", port=8000)
ip= str(Config.get('http_host'))
port = int(Config.get('http_port'))
http_server = WSGIServer((ip, port), app)
print("Serving HTTP on "+ip+" port "+str(port)+"...")
http_server.serve_forever()

if __name__ == '__main__':
PythonCornerExample.parse_command_line()


HttpApi.py:

from flask import Flask, request, json
from gevent.pywsgi import WSGIServer
'''
auth:***
desc: http api接口
date:20210202
'''
app = Flask(__name__)

#根据图片url查询
@app.route('/vin/imgurl')
def vinCodeByImage():
imgUrl = request.args.get("imgurl")
if imgUrl=='' or len(imgUrl) ==0:
return json.dumps({"error":True,"data":'',"message":'imgUrl could not be null'}, ensure_ascii=False, encoding="UTF-8")
zpSaas=ZpSaas()
jsonObj=zpSaas.checkVin(imgUrl)
error=False
mesaage=''
if jsonObj['code']=='':
error=True
mesaage='未识别'
else:
error = False
mesaage = '成功识别'
return json.dumps({"error": error, "data": jsonObj, "message": mesaage}, ensure_ascii=False, encoding="UTF-8")


原文:https://www.jianshu.com/p/13302948dbe6