Skip to content

Commit 0212f7f

Browse files
Pass polytope from_source kwargs to polytope client (#368)
1 parent 6b2d41b commit 0212f7f

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

docs/release_notes/version_0.7_updates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ New features
2121
- added support for Lambert Conformal projection when using :meth:`Field.projection() <data.core.fieldlist.Field.projection>`
2222
- changed the default of the ``bits_per_value`` option to None in :meth:`NumpyFieldList.save() <data.sources.numpy_list.NumpyFieldList.save>`. None means the original ``bits_per_value`` in the GRIB header is kept when the data is written to disk.
2323
- added the ``model`` option to the :ref:`data-sources-eod` source
24-
- added the ``prompt`` optional argument to certain retrievals to control whether the prompt is to use. When enabled (default), the prompt asks the user to provide credentials when none seems to be specified. See the :ref:`data-sources-cds`, :ref:`data-sources-mars`, :ref:`data-sources-wekeo`, :ref:`data-sources-wekeocds` sources for more information on how the prompt works.
24+
- added the ``prompt`` optional argument to certain retrievals to control whether the prompt is to be used. When enabled (default), the prompt asks the user to provide credentials when none seems to be specified. See the :ref:`data-sources-cds`, :ref:`data-sources-mars`, :ref:`data-sources-wekeo`, :ref:`data-sources-wekeocds` sources for more information on how the prompt works.
2525
- added the ``user_email`` and ``user_key`` options to the :ref:`data-sources-polytope` source. This source does not use the prompt any longer.
2626
- allowed using :func:`save` without specifying a file name. In this case an attempt is made to generate the filename automatically, when it fails an exception is thrown.
2727
- :func:`from_source` now fails when trying to load an empty file

earthkit/data/sources/polytope.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,10 @@ def __init__(
7676

7777
self.stream = stream
7878

79-
# Polytope client configuration options
80-
client_kwargs = {}
81-
for k in [
82-
"config_path",
83-
"address",
84-
"port",
85-
"username",
86-
"key_path",
87-
"quiet",
88-
"verbose",
89-
"log_file",
90-
"log_level",
91-
"user_key",
92-
"user_email",
93-
"password",
94-
"insecure",
95-
"skip_tls",
96-
"cli",
97-
]:
98-
if k in kwargs:
99-
client_kwargs[k] = kwargs.pop(k, None)
100-
10179
self.request = dict(dataset=dataset, request=request)
102-
self.client = polytope.api.Client(**client_kwargs)
80+
81+
# all the kwargs are passed to the client!
82+
self.client = polytope.api.Client(**kwargs)
10383

10484
def __repr__(self) -> str:
10585
return f"{self.__class__.__name__}({self.request['dataset']}, {self.request['request']})"

0 commit comments

Comments
 (0)