kepware http接口 c语言 python
2024-10-15 17:26:27
读取某变量的值(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': "",
'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': "",
'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)
最新文章
- ubuntu下常用命令(一)
- 下载安装与配置 Java JDK 7
- POJ 3304 Segments【叉积】
- c#部分---递归题目;猴子摘桃
- 基于XMPP的即时通信系统的建立(五)— openfire
- 再回首,Java温故知新(二):Java基本数据类型
- 如何查找ORACLE中的跟踪文件
- Passenger/Nginx/Debian快速部署Rails
- ubuntu开启openssh-server,ssh[xshell]
- 2013 QCon北京演讲:跨终端的WebKit渲染机制
- CentOS7安装codeblocks(转载)
- Servlet服务器、客户端跳转
- python学习(list增删改查、及常用方法)
- 卷积转换为矩阵运算中填充数的计算-GEMM
- Parallel.ForEach 多线程 声明失败 ";未将对象引用设置到对象的实例";
- ElasticSearch权威指南学习(文档)
- mysql 5.7 版本的安装
- Codeforces 603A - Alternative Thinking - [字符串找规律]
- Python之路【第十一篇】: 进程与线程
- 2-12-配置squid代理服务器加快网站访问速度