diff options
author | Gionata Biavati <Gionata.Biavati@ecmwf.int> | 2018-09-20 09:23:57 +0100 |
---|---|---|
committer | Gionata Biavati <Gionata.Biavati@ecmwf.int> | 2018-09-20 09:23:57 +0100 |
commit | 7f29b56934f7857beb950bda01a69ba5033289ba (patch) | |
tree | 6a551624f8908f96d8a513d16efcefc4321dc66a /cdsapi/api.py | |
parent | 6b6c271a380a05de6c03341f3f7573e30a02b530 (diff) |
added __enter__ and __exit__ methods
Diffstat (limited to 'cdsapi/api.py')
-rw-r--r-- | cdsapi/api.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cdsapi/api.py b/cdsapi/api.py index 9160916..4823bd6 100644 --- a/cdsapi/api.py +++ b/cdsapi/api.py @@ -149,6 +149,13 @@ class Client(object): logger = logging.getLogger('cdsapi') + def __enter__(self, **kwargs): + self.__init__(**kwargs) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + pass + def __init__(self, url=os.environ.get('CDSAPI_URL'), key=os.environ.get('CDSAPI_KEY'), |