80 lines
1.8 KiB
Python
80 lines
1.8 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)
|
|
|
|
if __name__ == '__main__':
|
|
set_call_back()
|