Hi Team,
I am trying to call Octopus REST API from Python.
Can someone help me to correct my script.
I am new to Python.
This is the script I use. (It doesnt work)
import json
import requests
apiKey = ‘API-XXXXXXXXXXXX’
header = {“Content-Type”: “application/json”, “X-Octopus-ApiKey”: apiKey}
octopus_url = “https://deploy.mycompanyname.com/Octopus/api/tasks/ServerTasks-168240/details”
s = requests.Session()
s.headers.update(header)
resp = s.get(octopus_url, headers={“Content-Type”: “application/json”, “X-Octopus-ApiKey”: apiKey})
if resp.status_code != 200:
print('error: ’ + str(resp.status_code))
else:
print(‘Success’)
I get too many errors like
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘deploy.mycompanyname.com’, port=443): Max retries exceeded with url: /Octopus/api/tasks/ServerTasks-168240/details (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)’)))
During handling of the above exception, another exception occurred: