28 lines
820 B
Python
28 lines
820 B
Python
# -*-coding:utf-8 -*-
|
|
import requests
|
|
class VideoNotice():
|
|
def __init__(self, base_url, dir_name):
|
|
"""定义和初始化类属性base_url(请求地址)和dir_name(文件夹名称)"""
|
|
self.base_url = base_url
|
|
self.dir_name = dir_name
|
|
|
|
def send_notice(self):
|
|
"""生成新文件后发生通知"""
|
|
# 组装请求参数
|
|
data = dict(
|
|
dir_name=self.dir_name
|
|
)
|
|
# 添加参数请求
|
|
req = requests.get(self.base_url, params=data)
|
|
# 下面是响应的内容
|
|
return req.text
|
|
|
|
|
|
# 使用方法:
|
|
# 1、根据类创建实例
|
|
# notice_model = VideoNotice('http://192.168.200.29:1001/guangyd/videoNotice','000120210319141950')
|
|
#
|
|
# # 2、调用通知方法,发送通知
|
|
# content = notice_model.send_notice()
|
|
# print(content)
|