MarcoBuster MarcoBuster - 2 months ago 14
Python Question

Python Requests TypeError: not all arguments converted during string formatting

I'm using Python requests module, but I'm in a trouble.
I'm trying to do a request, this is the code:

params = {"user_id":"1234567890", "api":"API-KEY"}
method = 'getUserStatus'
requests.get("https://www.example.com/“ % method, params)


But I get this error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting


Thanks for reply,
Marco

Answer

You need to update your code with right formatting - requests.post('https://api.iata.ovh/{0}.format(method), params)