I am trying to make a twitter bot that uses requests library to get data from nytimes api.
There is a line in the code
resp = requests.get(API_ENDPOINT, my_params)
Now this works very well when I run it locally. So I uploaded it to pythonanywhere. The moment I tried to run it I got this error:
resp = requests.get(API_ENDPOINT, my_params)
TypeError: get() takes exactly 1 argument (2 given)
What is happening? I have started using requests as well as pythonanywhere recently. So I have literally no idea where to start debugging.
2
Answers
You have different
requests
versions installed on PythonAnywhere and locally.From what I see
requests
version installed on PythonAnywhere is2.4.0
. At that point, you had to specifyparams
keyword argument explicitly:And you have to write:
In the most recent version (
2.10.0
at the moment), you can haveparams
specified as a positional argument:You can do it like this: