import requests
import json
url = 'mywebsite/test.php'
myobj = data = {"username" : "test", "password" : "1234"}
myobj = json.dumps(myobj)
x = requests.post("loginUser",url, data = myobj)
print(x)
I get the following error:
Traceback (most recent call last):
File "main.py", line 55, in <module> x = requests.post("loginUser",url, data = myobj) TypeError: post() got multiple values for argument 'data'
Can anyone help with this?
requests.post(url, data=None, json=None, **kwargs). You use "loginUser" as the url, and your url as data, so double data. What is your intent for "loginUser"? What is it supposed to do?requests.post(url, data = myobj)will work - assuming that your test.php hard codes the call tologinUser.