121 lines
3.3 KiB
Python
121 lines
3.3 KiB
Python
import requests
|
|
import json
|
|
|
|
base_url = "http://192.168.2.240:2531/v2/api"
|
|
|
|
headers = {
|
|
'X-GEWE-TOKEN': 'cb43f52db27e4a56bb6ec7da54373582',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
app_id = "wx_3BC6eSHGE5xEm_hH3__7c"
|
|
|
|
|
|
def get_chatroom_members():
|
|
url = "/group/getChatroomMemberList"
|
|
|
|
payload = json.dumps({
|
|
"appId": app_id,
|
|
"chatroomId": "52418238895@chatroom"
|
|
|
|
})
|
|
|
|
response = requests.request("POST", base_url + url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
|
|
|
|
def revoke_msg():
|
|
url = "/message/revokeMsg"
|
|
|
|
payload = json.dumps({
|
|
"appId": app_id,
|
|
"toWxid": "34757816141@chatroom",
|
|
"msgId": "769533801",
|
|
"newMsgId": "5271007655758710001",
|
|
"createTime": "1704163145"
|
|
})
|
|
|
|
response = requests.request("POST", base_url + url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
|
|
def set_call_back():
|
|
|
|
url = "/tools/setCallback"
|
|
|
|
payload = json.dumps({
|
|
"token": "cb43f52db27e4a56bb6ec7da54373582",
|
|
"callbackUrl": "http://192.168.2.212:8999/gewechat/message/callback"
|
|
})
|
|
headers = {
|
|
'X-GEWE-TOKEN': 'cb43f52db27e4a56bb6ec7da54373582',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
response = requests.request("POST",base_url+ url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
|
|
def send_file():
|
|
|
|
url = "/message/postFile"
|
|
|
|
payload = json.dumps({
|
|
"appId": app_id,
|
|
"toWxid": "52418238895@chatroom",
|
|
"fileName": "favicon.ico",
|
|
"fileUrl": "http://192.168.2.210:8888/static/favicon.ico"
|
|
})
|
|
headers = {
|
|
'X-GEWE-TOKEN': 'cb43f52db27e4a56bb6ec7da54373582',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
response = requests.request("POST", base_url+url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
|
|
|
|
def download_file():
|
|
|
|
url = "/message/downloadImage"
|
|
xml ="""<?xml version="1.0"?>
|
|
<msg>
|
|
<img aeskey="d57b3b0f339a09014a615d2b20e2cb67" encryver="1" cdnthumbaeskey="d57b3b0f339a09014a615d2b20e2cb67" cdnthumburl="3057020100044b304902010002042d0c366c02032dd08502046e5c0caf0204680f0e52042435323638326132302d646232652d343361632d616638332d6632373561343166353039360204052418020201000405004c537500" cdnthumblength="8976" cdnthumbheight="69" cdnthumbwidth="150" cdnmidheight="0" cdnmidwidth="0" cdnhdheight="0" cdnhdwidth="0" cdnmidimgurl="3057020100044b304902010002042d0c366c02032dd08502046e5c0caf0204680f0e52042435323638326132302d646232652d343361632d616638332d6632373561343166353039360204052418020201000405004c537500" length="72485" md5="9a2b154bc39c3148e624693ad1b90d7e" originsourcemd5="9a2b154bc39c3148e624693ad1b90d7e">
|
|
<secHashInfoBase64 />
|
|
<live>
|
|
<duration>0</duration>
|
|
<size>0</size>
|
|
<md5 />
|
|
<fileid />
|
|
<hdsize>0</hdsize>
|
|
<hdmd5 />
|
|
<hdfileid />
|
|
<stillimagetimems>0</stillimagetimems>
|
|
</live>
|
|
</img>
|
|
<platform_signature />
|
|
<imgdatahash />
|
|
<ImgSourceInfo>
|
|
<ImgSourceUrl />
|
|
<BizType>0</BizType>
|
|
</ImgSourceInfo>
|
|
</msg>
|
|
"""
|
|
payload = json.dumps({
|
|
"appId": app_id,
|
|
"type": 2,
|
|
"xml": xml
|
|
})
|
|
headers = {
|
|
'X-GEWE-TOKEN': 'cb43f52db27e4a56bb6ec7da54373582',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
response = requests.request("POST", base_url+url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
|
|
if __name__ == '__main__':
|
|
download_file()
|