How to send an array using requests.post (Python)? “Value Error: Too many values to unpack”

前端 未结 4 1808
暖寄归人
暖寄归人 2020-12-13 01:52

I\'m trying to send an array(list) of requests to the WheniWork API using requests.post, and I keep getting one of two errors. When I send the list as a list, I get an unpac

4条回答
  •  生来不讨喜
    2020-12-13 02:49

    Well, It turns out that all I needed to do was add these headers:

    headers = {'Content-Type': 'application/json', 'Accept':'application/json'}
    

    and then call requests

    requests.post(url,data=json.dumps(payload), headers=headers)
    

    and now i'm good!

提交回复
热议问题