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

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 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