代码拉取完成,页面将自动刷新
from epics import PV
from logger import getLogger
import requests
import time
logger = getLogger("PV")
url = "http://127.0.0.1:8099/api/modeconf/notice"
class PV_Class():
def __init__(self):
self._uuid = "TEST:Mode:uuid"
self.task_id_conn = False
self.uuid_conn = False
self.uuid = PV(self._uuid,callback=self.onValueChange,connection_callback=self.onConnectionChange)
logger.info("Init finish")
def onConnectionChange(self,pvname=None ,conn= None,**kws):
if pvname == self._uuid:
self.uuid_conn = conn
def onValueChange(self,pvname=None, value=None, host=None, **kws):
if self.uuid_conn:
if not len(self.uuid.get(as_string = True)) == 0:
params = {"task_id":self.uuid.get(as_string = True).replace(" ","").split("&")[0],"uuid":self.uuid.get(as_string = True).replace(" ","").split("&")[1],"source":1}
res = requests.get(url = url,params = params)
logger.info("data:"+str(params)+"\tresult:"+str(res.text))
if __name__ == "__main__":
pv = PV_Class()
while True:
time.sleep(1)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。