MiraiForum

    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    python发消息的http请求参数错误

    HTTP API和第三方SDK
    python message
    1
    2
    34
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wihn2021 last edited by

      这是我的代码

      import requests
      md = {'sessionKey':'XXXXXXX','target':711XXXXX96,'messageChain':[{'type':'Plain','text':'hello'},{'type':'Plain','text':'world'}]}
      headers = {'Content-Type': 'application/json'}
      r4 = requests.post('http://XXXXXXXXX/sendGroupMessage',data=json.dumps(md),headers=headers)
      

      结果是400,参数错误。我试了不把json转化成字符串,也发生了参数错误,请问我应该怎么做?

      1 Reply Last reply Reply Quote 0
      • W
        wihn2021 last edited by wihn2021

        md = {'sessionKey':'RxxxxxeLr','target':71xxxxx96,'messageChain':[{'type':'Plain','text':'hello'},{'type':'Plain','text':'world'}]}
        r4 = requests.post('http://xxxxxx/sendGroupMessage',json=md)

        这是现在的代码,然而还是【无效参数】

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact us