找回密码
 立即注册
搜索
热搜: 有货 线报 好价
查看: 9|回复: 0

python请教

[复制链接]

1

主题

0

回帖

4

积分

新手上路

积分
4
发表于 2022-2-16 16:38 | 显示全部楼层 |阅读模式
易语言中是
返回数据 = 编码_utf8到gb2312 (到文本 (网页_访问_对象 (“http://” + 海康IP + “/artemis-web/debug”, 1, #提交信息, , , #协议头 )))

#提交信息内容如下
{"httpMethod":"POST","path":"/api/acs/v2/door/events","headers":{},"query":{},"parameter":{},
"body":{"pageNo":1,"pageSize":200,"sort":"personName",
"doorName":"199",
"receiveStartTime": "2001-10-25T00:00:00+08:00",
"receiveEndTime": "2991-10-25T23:59:59+08:00",
"startTime": "2022-02-16T00:00:00+08:00",
"endTime": "2022-02-16T23:59:59+08:00",
"order":"asc"},
"contentType":"application/json;charset=UTF-8",
"mock":false,
"appKey":"284",
"appSecret":"S"
}
#协议头内容如下
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 657
Content-Type: application/json;charset=UTF-8
Cookie: __guid=121; monitor_count=11; browserLan=zh_CN; sessionId=5e9
Host: 192.10.70.121:9017
Origin: http://192.10.70.121:9017
Pragma: no-cache
Referer: http://192.10.70.121:9017/artemis-web/debug/1203058956629442560
User-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
X-Requested-With: XMLHttpRequest

可以正常运行


求教python中如何编写
def posti():
    headers = {
        'Accept': 'application/json, text/plain, */*',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Cache-Control': 'no-cache',
        'Connection': 'keep-alive',
        'Content-Length': '657',
        'Content-Type': 'application/json;charset=UTF-8',
        'Cookie': ' __guid=121; monitor_count=11; browserLan=zh_CN; sessionId=5e9',
        'Host': '192.10.70.121:9017',
        'Origin': 'http://192.10.70.121:9017',
        'Pragma': 'no-cache',
        'Referer': 'http://192.10.70.121:9017/artemis-web/debug/1203058956629442560',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
        'X-Requested-With': 'XMLHttpRequest'

    }
    httpURL = "http://192.10.70.121:9017/artemis-web/debug"
    data = {
        "httpMethod": "POST", "path": "/api/acs/v2/door/events", "headers": {}, "query": {}, "parameter": {},
        "body": {"pageNo": 1, "pageSize": 200, "sort": "personName",
                 "doorName": "199",
                 "receiveStartTime": "2001-10-25T00:00:00+08:00",
                 "receiveEndTime": "2991-10-25T23:59:59+08:00",
                 "startTime": "2022-02-16T00:00:00+08:00",
                 "endTime": "2022-02-16T23:59:59+08:00",
                 "order": "asc"},
        "contentType": "application/json;charset=UTF-8",
        "mock": "false",
        "appKey": "284",
        "appSecret": "S"
    }
    response_post = requests.post(httpURL, data=data,headers=headers, timeout=30)   
    print(response_post.text)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|赚趣网
提醒:本站内容来源于互联网,未经验证,请自行甄别,谨防受骗! 如有侵权,不良信息请第一时间联系我们删除!敬请谅解!

GMT+8, 2026-7-15 05:47 , Processed in 0.078080 second(s), 11 queries , MemCache On.

Powered by Discuz! X3

快速回复 返回顶部 返回列表