search

Home  >  Q&A  >  body text

python - How to use requests module to submit data with multiple same names in one post?

As shown in the picture, there are three fields in the data submitted to be posted, all named tags[], but the contents are different. What should I do to post all three fields?

迷茫迷茫2729 days ago772

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-12 09:21:36

    First line view source

    reply
    0
  • 迷茫

    迷茫2017-06-12 09:21:36

    You can merge the three fields on the client side into a JSON string into one field, and then decode it when getting it on the server side and it’s OK

    reply
    0
  • 巴扎黑

    巴扎黑2017-06-12 09:21:36

    If you can use the python requests module, you can refer to the answer here How to submit multiple files with the same POST name with requests?

    parameters = [('tags', 'test'), ('tags', 'submit'), ('tags', 'tool')]
    

    Then use the method you are accustomed to, such as

    r = requests.get("http://httpbin.org/get", params=parameters )
    

    reply
    0
  • Cancelreply