• kepware http接口 c语言 python


    读取某变量的值(http.client

    import http.client
    
    conn = http.client.HTTPConnection("127,0,0,1")
    
    headers = {
        'Connection': "keep-alive",
        'Cache-Control': "max-age=0",
        'Upgrade-Insecure-Requests': "1",
        'User-Agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
        'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        'Accept-Encoding': "gzip, deflate, br",
        'Accept-Language': "zh-CN,zh;q=0.9",
        'cache-control': "no-cache",
        }
    
    conn.request("GET", "iotgateway,read", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))

    读取某变量的值(requests

    import requests
    
    url = "http://127.0.0.1:39321/iotgateway/read"
    
    querystring = {"ids":["Channel1.Device1.tag1","Channel1.Device1.tag2"]}
    
    headers = {
        'Connection': "keep-alive",
        'Cache-Control': "max-age=0",
        'Upgrade-Insecure-Requests': "1",
        'User-Agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
        'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        'Accept-Encoding': "gzip, deflate, br",
        'Accept-Language': "zh-CN,zh;q=0.9",
        'cache-control': "no-cache",
        }
    
    response = requests.request("GET", url, headers=headers, params=querystring)
    
    print(response.text)
  • 相关阅读:
    oracle sql 汉字在库中占的字节数
    面试题:反转单词顺序
    面试题:平衡二叉树
    面试题:二叉树的深度
    面试题:二叉树的下一个节点
    面试题:数字在排序数组中出现的次数
    面试题:把数组排成最小的数
    面试题:二叉树与双向搜索树
    面试题:序列化二叉树
    面试题:字符串的全排列
  • 原文地址:https://www.cnblogs.com/dXIOT/p/10626705.html
Copyright © 2020-2023  润新知