In [1]:
from birdy import WPSClient

Get an access token


In [2]:
client_id = '7e09d5e948fd48c69418230b5f648a12'
client_secret = '46bf8197254f4816b68b6ba7412f1182'

In [11]:
import requests
url = 'https://cp4cds-cn2.dkrz.de/oauth/token?grant_type=client_credentials&client_id={}&client_secret={}'
token = requests.get(url.format(client_id, client_secret), verify=False)
token = token.json()
token


/home/tjs/.conda/envs/birdy/lib/python3.6/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-11-2ae21b056765> in <module>
      2 url = 'https://cp4cds-cn2.dkrz.de/oauth/token?grant_type=client_credentials&client_id={}&client_secret={}'
      3 token = requests.get(url.format(client_id, client_secret), verify=False)
----> 4 token = token.json()
      5 token

~/.conda/envs/birdy/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

~/.conda/envs/birdy/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

~/.conda/envs/birdy/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

~/.conda/envs/birdy/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Init WPS for climate explorer


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

cexp = WPSClient('https://cp4cds-cn2.dkrz.de/ows/proxy/cexp', 
                 progress=True, 
                 verify=False, 
                 headers=headers)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-b796a69331d8> in <module>
----> 1 headers = {'Authorization': 'Bearer {}'.format(token['access_token'])}
      2 
      3 cexp = WPSClient('https://cp4cds-cn2.dkrz.de/ows/proxy/cexp', 
      4                  progress=True,
      5                  verify=False,

NameError: name 'token' is not defined

Run process


In [5]:
help(cexp.correlate_field)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-aeaeb5f025a8> in <module>
----> 1 help(cexp.correlate_field)

NameError: name 'cexp' is not defined

In [6]:
response = cexp.correlate_field()


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-d3c8e6543da6> in <module>
----> 1 response = cexp.correlate_field()

NameError: name 'cexp' is not defined

In [7]:
response.getStatus()


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-0a5c65f257f8> in <module>
----> 1 response.getStatus()

NameError: name 'response' is not defined

In [8]:
response.get()


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-e56300f95786> in <module>
----> 1 response.get()

NameError: name 'response' is not defined

In [ ]: