summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-03-29 13:06:42 +0200
committerGard Spreemann <gspr@nonempty.org>2020-03-29 13:06:42 +0200
commit7a8cb4f4da753b19954d8c78d8588787a32e3ebe (patch)
tree419f38ad39929eca8cc941a2701ac8926cdcaf36
parent0c28fb7da83c7afba74416a88682eb931d874ce4 (diff)
Upstream 0.2.7 tarball as released on PyPI.upstream/0.2.7
-rw-r--r--PKG-INFO2
-rw-r--r--cds-test.py32
-rw-r--r--cdsapi.egg-info/PKG-INFO2
-rw-r--r--cdsapi.egg-info/SOURCES.txt1
-rw-r--r--cdsapi/api.py18
-rw-r--r--setup.py2
6 files changed, 19 insertions, 38 deletions
diff --git a/PKG-INFO b/PKG-INFO
index 5c327c1..3498dd5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: cdsapi
-Version: 0.2.5
+Version: 0.2.7
Summary: Climate Data Store API
Home-page: https://software.ecmwf.int/stash/projects/CDS/repos/cdsapi
Author: ECMWF
diff --git a/cds-test.py b/cds-test.py
deleted file mode 100644
index 30d3fa0..0000000
--- a/cds-test.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright 2018 ECMWF.
-#
-# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
-# granted to it by virtue of its status as an intergovernmental organisation nor
-# does it submit to any jurisdiction.
-
-import cdsapi
-
-
-c = cdsapi.Client(full_stack=True,
- #url='https://cds-test.climate.copernicus.eu/api/v2',
- #key='1:1c2ab50b-2208-4d84-b59d-87154cae4441',
- debug=True, quiet=False)
-
-# print(c.status())
-
-r = c.retrieve(
- "reanalysis-era5-pressure-levels",
- {
- "variable": "temperature",
- "pressure_level": "all",
- "product_type": "reanalysis",
- "date": "2017-12-01/2017-12-30",
- "time": "19:00",
- },
-)
-
-# r.download("x.grib")
diff --git a/cdsapi.egg-info/PKG-INFO b/cdsapi.egg-info/PKG-INFO
index 5c327c1..3498dd5 100644
--- a/cdsapi.egg-info/PKG-INFO
+++ b/cdsapi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: cdsapi
-Version: 0.2.5
+Version: 0.2.7
Summary: Climate Data Store API
Home-page: https://software.ecmwf.int/stash/projects/CDS/repos/cdsapi
Author: ECMWF
diff --git a/cdsapi.egg-info/SOURCES.txt b/cdsapi.egg-info/SOURCES.txt
index 9196f00..cbd1fce 100644
--- a/cdsapi.egg-info/SOURCES.txt
+++ b/cdsapi.egg-info/SOURCES.txt
@@ -2,7 +2,6 @@ CONTRIBUTING.rst
LICENSE.txt
MANIFEST.in
README.rst
-cds-test.py
example-era5.py
example-glaciers.py
setup.cfg
diff --git a/cdsapi/api.py b/cdsapi/api.py
index 80eaa59..1c8e598 100644
--- a/cdsapi/api.py
+++ b/cdsapi/api.py
@@ -242,6 +242,8 @@ class Client(object):
warning_callback=None,
error_callback=None,
debug_callback=None,
+ metadata=None,
+ forget=False,
):
if not quiet:
@@ -294,6 +296,9 @@ class Client(object):
self.session = requests.Session()
self.session.auth = tuple(self.key.split(':', 2))
+ self.metadata = metadata
+ self.forget = forget
+
self.debug("CDSAPI %s", dict(url=self.url,
key=self.key,
quiet=self.quiet,
@@ -303,7 +308,9 @@ class Client(object):
sleep_max=self.sleep_max,
retry_max=self.retry_max,
full_stack=self.full_stack,
- delete=self.delete
+ delete=self.delete,
+ metadata=self.metadata,
+ forget=self.forget,
))
def retrieve(self, name, request, target=None):
@@ -315,7 +322,10 @@ class Client(object):
def service(self, name, *args, **kwargs):
self.delete = False # Don't delete results
name = '/'.join(name.split('.'))
- request = toJSON(dict(args=args, kwargs=kwargs))
+ request = dict(args=args, kwargs=kwargs)
+ if self.metadata:
+ request['_cds_metadata'] = self.metadata
+ request = toJSON(request)
result = self._api('%s/tasks/services/%s/clientid-%s' % (self.url, name, uuid.uuid4().hex), request, 'PUT')
return result
@@ -369,6 +379,10 @@ class Client(object):
json=request,
verify=self.verify,
timeout=self.timeout)
+
+ if self.forget:
+ return result
+
reply = None
try:
diff --git a/setup.py b/setup.py
index d1d74bd..ba51367 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ def read(fname):
return io.open(file_path, encoding='utf-8').read()
-version = '0.2.5'
+version = '0.2.7'
setuptools.setup(