diff options
author | Eddy <maec@ecmwf.int> | 2020-08-14 12:42:56 +0100 |
---|---|---|
committer | Eddy <maec@ecmwf.int> | 2020-08-14 12:42:56 +0100 |
commit | 3c98ca1531cdab6b56d9dac8278b831624f6f3d9 (patch) | |
tree | fb6e30cd10b1dd82dd021f880531413f54ffcacf | |
parent | 7b8ac266be9f0843ece82e1bb5e9b2ac41a0be46 (diff) |
Mimic CDS UI requests
-rw-r--r-- | cdsapi/api.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cdsapi/api.py b/cdsapi/api.py index 2befa13..029c1c7 100644 --- a/cdsapi/api.py +++ b/cdsapi/api.py @@ -332,10 +332,16 @@ class Client(object): result.download(target) return result - def service(self, name, *args, **kwargs): + def service(self, name, *args, mimic_ui=False, **kwargs): self.delete = False # Don't delete results name = '/'.join(name.split('.')) request = dict(args=args, kwargs=kwargs) + # To mimic the CDS ui the args must included directly at the top level of the request + # This is applicable to preloading application workflows + if mimic_ui: + request.update(request['args'][0]) + del request['args'] + if self.metadata: request['_cds_metadata'] = self.metadata request = toJSON(request) |