summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEddy <maec@ecmwf.int>2020-08-18 17:51:02 +0100
committerEddy <maec@ecmwf.int>2020-08-18 17:51:02 +0100
commit7576e1b17c78270211f9524166e4539245efc621 (patch)
treed33325d14657a636ebea52449387c28a9416186f
parent3c98ca1531cdab6b56d9dac8278b831624f6f3d9 (diff)
Directly populate the request with kwargs
-rw-r--r--cdsapi/api.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/cdsapi/api.py b/cdsapi/api.py
index 029c1c7..5726489 100644
--- a/cdsapi/api.py
+++ b/cdsapi/api.py
@@ -335,12 +335,11 @@ class Client(object):
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
+ # To mimic the CDS ui the request should be populated directly with the kwargs
if mimic_ui:
- request.update(request['args'][0])
- del request['args']
+ request = kwargs
+ else:
+ request = dict(args=args, kwargs=kwargs)
if self.metadata:
request['_cds_metadata'] = self.metadata