吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1379|回复: 1
收起左侧

[求助] 求帮忙 关于石墨文档的表单 提交接口问题

[复制链接]
TechPeng 发表于 2021-7-29 23:04
50吾爱币
本帖最后由 TechPeng 于 2021-7-30 20:34 编辑

微信截图_20210729224424.jpg

链接地址: https://shimo.im/forms/3gDyHRvvVHxVQryy/fill
通过浏览器获取了 提交的接口 https://shimo.im/api/newforms/forms/3gDyHRvvVHxVQryy/submit 链接 和参数


我使用Postman 可以提交成功,但用python 一直400


求各位大佬帮忙

最佳答案

查看完整内容

完整代码给你 [mw_shl_code=python,true]# -*- coding: utf-8 -*- from requests import Session def main(*args): headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", "Accept": "application/json, text/plain, */*", "Accept-Language": "zh-CN,zh;q=0.9", "Accept-Encoding": ...

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Jack2002 发表于 2021-7-29 23:04
本帖最后由 Jack2002 于 2021-8-2 10:40 编辑

完整代码给你
[Python] 纯文本查看 复制代码
# -*- coding: utf-8 -*-
from requests import Session

def main(*args):
        headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
        "Accept": "application/json, text/plain, */*",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Accept-Encoding": "gzip, deflate, br",
        "Content-Type": "application/json;charset=UTF-8",
        "Cookie": "acw_tc=2760824616278701141955252e5efe261c712f620559d43111857f7a992a32; shimo_sid=s%3A719080c6949540d6883a2274f4d2546b.pZAQ9XjAU%2B%2BMjRbWGx%2BFtYKtRkZ2ApBErKIQPgpHDTM; anonymousUser=-735830681; deviceId=browser-6713d9eb-86f7-fd82-8005-e0a01e7c1976; sajssdk_2015_cross_new_user=1; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2217b0482ec841c9-006395e0267596-3e604809-1fa400-17b0482ec856bf%22%2C%22%24device_id%22%3A%2217b0482ec841c9-006395e0267596-3e604809-1fa400-17b0482ec856bf%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_referrer%22%3A%22%22%2C%22%24latest_referrer_host%22%3A%22%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%7D%7D; sensorsdata2015session=%7B%7D; deviceId=svc-9e02bfa4-3244-40a8-98fd-156e37f27a7d; udid=df60f4c84d1a2280b492IOw8S0Pn8cWWtb",
        "DNT": "1",
        "Connection": "keep-alive",
        "cache-control": "no-cache",
        "pragma": "no-cache",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        "origin": "https://shimo.im",
        "Referer": "https://shimo.im/forms/3gDyHRvvVHxVQryy/fill"}

        s = Session()
        s.headers = headers
        szUrl:str = "https://shimo.im/forms/3gDyHRvvVHxVQryy/fill"
        s.get(szUrl)
        
        data:dict = {"formRev":1,
        "userFinger":"-1",
        "userName":"",
        "duration":29,
        "responseContent":[{"type":9,"guid":"AruMTHYd","text":{"content":"123"}},{"type":0,"guid":"d1kmXOF5","text":{"content":"456"}},{"type":4,"guid":"Y74tOmyW","text":{"content":"789"}}]}

        s.headers["content-length"] = str(len(str(data)))
        szUrl:str = "https://shimo.im/api/newforms/forms/3gDyHRvvVHxVQryy/submit"
        res = s.post(szUrl, json=data)
        print("status_code:", res.status_code)

main()

运行结果:返回状态码204,跟浏览器返回结果一致。
屏幕截图 2021-08-02 103432.jpg
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 00:41

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表