Calling a workflow via a python script
I'm trying to call the REST endpoint of a Geocortex workflow from python. Has anyone managed to do this?
I'm using the Request python package which looks working ok however I can't seem to get around the authorisation part. I keep getting a 401 unauthorised error.
This is the python code for reference.
import requests
wf = r"http://myserver/Geocortex/Essentials/Geocortex/REST/sites/Dev/workflows/testWF/run"
r = requests.get(wf, auth=('user', 'pwd'))
I'm able to navigate to the REST endpoint of the workflow in a browser and run it that way so I know it's working ok. It's just the authentication I can't seem to get to work.
Thanks for reading.
0
-
Just thought I'd post an update incase anyone wanted to know.
I got around the authenication issue by using NTLM authentication. I also had to include ReadyToRun=1 in the request.
The updated python code is:
import requests
from requests_ntlm import HttpNtlmAuth
wf = "http://myserver/Geocortex/Essentials/Geocortex/REST/sites/Dev/workflows/testWF/run?ReadyToRun=1"
r = requests.get(wf, auth=HttpNtlmAuth('domain\\user', 'pwd'))0
Please sign in to leave a comment.
Comments
1 comment