Skip to content

Commit a8ecf1e

Browse files
authored
Change default server, fix bug writing config to file (#1393)
* Change default server, fix bug writing config to file * update the production server url for 'production' * Revert api.openml to www.openml
1 parent 00d1766 commit a8ecf1e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

openml/config.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,15 @@ def _resolve_default_cache_dir() -> Path:
164164
def get_server_base_url() -> str:
165165
"""Return the base URL of the currently configured server.
166166
167-
Turns ``"https://www.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"``
167+
Turns ``"https://api.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"``
168+
and ``"https://test.openml.org/api/v1/xml"`` in ``"https://test.openml.org/"``
168169
169170
Returns
170171
-------
171172
str
172173
"""
173-
return server.split("/api")[0]
174+
domain, path = server.split("/api", maxsplit=1)
175+
return domain.replace("api", "www")
174176

175177

176178
apikey: str = _defaults["apikey"]
@@ -400,10 +402,9 @@ def set_field_in_config_file(field: str, value: Any) -> None:
400402
# There doesn't seem to be a way to avoid writing defaults to file with configparser,
401403
# because it is impossible to distinguish from an explicitly set value that matches
402404
# the default value, to one that was set to its default because it was omitted.
403-
value = config.get("FAKE_SECTION", f) # type: ignore
404-
if f == field:
405-
value = globals()[f]
406-
fh.write(f"{f} = {value}\n")
405+
value = globals()[f] if f == field else config.get(f) # type: ignore
406+
if value is not None:
407+
fh.write(f"{f} = {value}\n")
407408

408409

409410
def _parse_config(config_file: str | Path) -> _Config:

0 commit comments

Comments
 (0)