I have a test url
https://test.app.com/api/rest
In order to access the url and its contents, it is necessary to send headers as
headers={"Content-Type":"application/json"}
And also basic authentication is to be used, where credentials are
username=apple , password=ball
I have used
from requests.auth import HTTPBasicAuth
requests.post(URL,auth=HTTPBasicAuth(username, password),
data=data,
headers=headers)
Is this the correct way to send post request to a url also sending headers and basic authentication ?
data=json.dumps(data)