summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorb8raoult <53792887+b8raoult@users.noreply.github.com>2020-09-15 10:35:24 +0100
committerGitHub <noreply@github.com>2020-09-15 10:35:24 +0100
commitd9c212e44b2652f6a2bfeee310c01bbad3b47679 (patch)
tree4479c93205b23f5008d81e6e5e59bc12fa816415
parentd1b2c46c6983272d55051a2a41ab3bf1bf4d628e (diff)
parent7576e1b17c78270211f9524166e4539245efc621 (diff)
Merge pull request #23 from EddyCMWF/master
mimic CDS UI
-rw-r--r--cdsapi/api.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cdsapi/api.py b/cdsapi/api.py
index 2befa13..5726489 100644
--- a/cdsapi/api.py
+++ b/cdsapi/api.py
@@ -332,10 +332,15 @@ 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 request should be populated directly with the kwargs
+ if mimic_ui:
+ request = kwargs
+ else:
+ request = dict(args=args, kwargs=kwargs)
+
if self.metadata:
request['_cds_metadata'] = self.metadata
request = toJSON(request)