From 3c98ca1531cdab6b56d9dac8278b831624f6f3d9 Mon Sep 17 00:00:00 2001 From: Eddy Date: Fri, 14 Aug 2020 12:42:56 +0100 Subject: Mimic CDS UI requests --- cdsapi/api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cdsapi') 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) -- cgit v1.2.3