【问题标题】:python requests - posting multiple values with same key, combined with regular keyspython请求 - 使用相同的键发布多个值,并结合常规键
【发布时间】:2016-04-02 11:02:55
【问题描述】:

我需要重现以下 POST 表单结构:

根据我的发现,我可以这样表示 sites 键的多个值:how to post multiple value with same key in python requests?

但是如何将这个多值键与常规键action 和extype 结合起来呢?我不能再使用常规的 dict 作为参数了。

【问题讨论】:

    标签: python forms python-requests


    【解决方案1】:

    我不明白你为什么不能使用“常规字典”。相反:

    params = {'sites[]': [951, 1007, ...], 'action': 'set', 'extype': 'exclude'}
    requests.post('url', data=params)
    

    【讨论】:

      猜你喜欢
      • 2014-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-14
      • 2013-06-11
      • 2015-05-06
      • 1970-01-01
      相关资源
      最近更新 更多