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

前端 未结 4 1807
暖寄归人
暖寄归人 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:51

    I have a similar case but totally different solution, I've copied a snipped of code which looks like that:

        resp_status, resp_data = requests.post(url, headers=headers, 
                                                    json=payload,  verify=False) 
    

    and this resulted in error :

    ValueError: too many values to unpack (expected 2)
    

    just assigning to one variable resolve the issue:

                response = requests.post(url, headers=headers, 
                                                  json=payload,  verify=False)
    

提交回复
热议问题