+ Start a Discussion
Diwakar G 7Diwakar G 7 

Salesforce API call for running Apex test using Python

Hi,
I am trying the below Python code for running Apex test.
import urllib2
from urllib2 import Request, urlopen
import json
values =[{"className":"TestVerifyDate","testMethods": ["testMethod1","testMethod2","testMethod3"]}]
values = json.dumps(values).encode('utf8') 
your_url="http://instance.salesforce.com/services/data/v44.0/tooling/"
req = Request(your_url, data=values,headers = {'Accept':'application/vnd.rn+json','Content-Type':'application/vnd.rn+json','Authorization':'Token token="<hexstring>"'})
response_body = urlopen(req).read()
print response_body
I am not sure what to give in token. I tried giving security token, API key. But, getting the below errror.
raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:480: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

Please help me.

Thanks and Regards,
Diwakar G​​​​​​​