Closed caioluccas closed 3 years ago
Body takes string.
so how can i post with json, like in requests?
thing = {"summonerName": nick_to_snipe, "accountId": account_id, "items"[{"inventoryType":"SUMMONER_CUSTOMIZATION","itemId":1,"rpCost": 1300, "quantity":1}]}
json.dumps(thing)
now its returning TypeError: Can't convert python obj of type 'dict' to string
Post the whole code, is hard to understand whats what just by variable names, make like a reduced example.
body
only takes string.
payload = {"summonerName": nick_to_snipe, "accountId": account_id, "items":[{"inventoryType":"SUMMONER_CUSTOMIZATION","itemId":1,"ipCost":13900, "quantity":1}]}
json.dumps(payload)
buy = requests.post(url, user_agent=user_agent, body=payload, http_headers=main_header)
payload = {"summonerName": nick_to_snipe, "accountId": account_id, "items":[{"inventoryType":"SUMMONER_CUSTOMIZATION","itemId":1,"ipCost":13900, "quantity":1}]}
payload_string = json.dumps(payload)
buy = requests.post(url, user_agent=user_agent, body=payload_string, http_headers=main_header)
i already tried it, its returning TypeError: Can't convert python obj of type 'list' to string
Then it is some of the other arguments that is failing. Post the whole code otherwise theres no way to know.
i fixed it, the problem was in user agent, thanks for your help
Im trying to do a POST request with json body but its returnig this error:
TypeError: Can't convert python obj of type 'list' to string