Using Twitcher Service


In [ ]:
# disable ssl warnings
import urllib3
urllib3.disable_warnings()

Register Client App


In [ ]:
base_url = 'http://localhost:8000'
# base_url = 'https://cp4cds-cn2.dkrz.de'
url = "{}/oauth/client?name={}".format(base_url, 'demo')
url

In [ ]:
import requests
resp = requests.get(url, verify=False, auth=("demo", "demo"))
resp.ok

In [ ]:
client = resp.json()
client

Get OAuth access token

scope=compute


In [ ]:
url = "{}/oauth/token?grant_type=client_credentials&client_id={}&client_secret={}&scope={}".format(
        base_url, client['client_id'], client['client_secret'], 'compute')
url

In [ ]:
resp = requests.get(url, verify=False)
resp.ok

In [ ]:
token = resp.json()
token

Execute WPS Process with access token


In [ ]:
url = "{}/ows/proxy/emu?service=WPS&version=1.0.0&request=Execute&identifier=chomsky".format(base_url)
url

In [ ]:
headers = {'Authorization': 'Bearer {}'.format(token['access_token'])}

resp = requests.get(url, headers=headers, verify=False)
resp.ok

In [ ]:
'ProcessSucceeded' in resp.text