You need to sign in to do that
Don't have an account?
Diwakar G 7
Conversion from Apex to Python
Hi,
Please help me to convert the below code to Python.
This code is used to run Apex test. Please help me.
Thanks and Regards,
Diwakar G
Please help me to convert the below code to Python.
var xhttp = new XMLHttpRequest(); xhttp.open("POST", "http://instance.salesforce.com/services/data/v44.0/tooling/runTestsSynchronous/", true) xhttp.setRequestHeader("Authorization", "OAuth <SESSION_ID>") xhttp.setRequestHeader('Accept',"application/json"); testObject = {tests: [{classId: "N0tARealClassId", testMethods: ["testMethod1", "testMethod2"]}]} requestObject = json.stringify(testObject); response = xhttp.send(requestObject) response = JSON.parse(response)
This code is used to run Apex test. Please help me.
Thanks and Regards,
Diwakar G
You can try below sample code
Reference link.
https://www.reddit.com/r/learnpython/comments/5a8fi9/sending_authorization_token_header_through_python/
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya
What I need to give in token?
I tried security token, API key but it is not working. I am getting 401 unauthorized error.
Please help me.
Thanks and Regards,
Diwakar G