diff --git a/gewechat/client/get_chatroom_members.py b/gewechat/client/get_chatroom_members.py index 3250289..5f3b3c1 100644 --- a/gewechat/client/get_chatroom_members.py +++ b/gewechat/client/get_chatroom_members.py @@ -75,5 +75,46 @@ def send_file(): print(response.text) + +def download_file(): + + url = "/message/downloadImage" + xml =""" + + + + + 0 + 0 + + + 0 + + + 0 + + + + + + + 0 + + + """ + 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__': - set_call_back() + download_file() diff --git a/utils/wechat/message_to_db.py b/utils/wechat/message_to_db.py index e535089..e21d472 100644 --- a/utils/wechat/message_to_db.py +++ b/utils/wechat/message_to_db.py @@ -122,11 +122,8 @@ class MessageStorage: # 确保目标目录存在 if not os.path.exists(target_dir): os.makedirs(target_dir, exist_ok=True) - # 延时10秒下载试试 - logger.info(f"延时10秒下载图片{msg.content.xml_content}") - time.sleep(10) # 尝试使用wcf下载图片到分组后的目录 - json = self.client.download_image(msg.appid, msg.content.xml_content, 1) + json = self.client.download_image(msg.appid, msg.content.xml_content, 2) # { # "ret": 200, # "msg": "操作成功",