联想产生于:https://www.529i.com/archives/761.html/comment-page-1
更新于友链LS博客:https://www.lvshuo.online/

# -*- coding: utf-8 -*-
import requests
import hashlib
import json

key = 'cantuse' #时光机验证编码
cid = "3"

# 判断上传类型(文字、图片or图文)
type = int(input("请输入上传类型:\n1.文字\n2.图片\n3.图文\n"))
if type == 1:
    text = str(input("请输入要上传的文字:\n"))
    date = {
        "action": "send_talk",
        "time_code": hashlib.md5(key.encode('utf-8')).hexdigest(),
        "cid": cid,  # 时光机cid
        "token": "crx",  # 识别浏览器还是微信改成其他的不显示
        "content": text,  # 发送文字
        "msg_type": "text",
        "mediaId": "1"
    }
elif type == 2:
    text = str(input("请输入本地图片路径:\n"))
    date = {
        "action": "upload_img",
        "time_code": hashlib.md5(key.encode('utf-8')).hexdigest(),
        "cid": cid,  # 时光机cid
        "token": "crx",  # 识别浏览器还是微信改成其他的不显示
        "content": text,  # 发送文字
        "msg_type": "image",
        "mediaId": "1"
    }
elif type == 3:
    # 请按此格式输入内容(只需改动中括号内的内容):{ "results":[{"type": "text","content": "test11"},{"type": "image","content": "图片完整路径"}] }
    # 直接修改然后复制即可
    text = str(input("请输入内容:\n "))
    # text = json.dumps(text)
    date = {
        "action": "send_talk",
        "time_code": hashlib.md5(key.encode('utf-8')).hexdigest(),
        "cid": cid,  # 时光机cid
        "token": "crx",  # 识别浏览器还是微信改成其他的不显示
        "content": text,  # 发送文字
        "msg_type": "mixed_talk",
        "mediaId": "1"
    }
else:
    print("输入类型错误!\n 请重试!!")
    exit()


s = requests.Session()
def getmd5(s):
    return hashlib.md5(s.encode('utf-8')).hexdigest()

url = 'http://blog.z13.wang/'
req = s.post(url=url,data=date)
print (req.text)

前面有三个库自己加载一下或者使用Anaconda Navigator软件,我记得这个软件是阿里有,改天分享出来

Last modification:February 28th, 2020 at 04:12 pm
如果觉得我的文章对你有用,请随意赞赏