Skip to content

Improve error message when API key is not provided #1089

Description

@mfeurer

The error message for a missing API key looks very generic and is not very user friendly:

Traceback (most recent call last):
  File "/home/feurerm/sync_dir/projects/openml/python/local/example.py", line 13, in <module>
    run = openml.runs.run_model_on_task(clf, task)  # run classifier on splits
  File "/home/feurerm/sync_dir/projects/openml/python/openml/runs/functions.py", line 140, in run_model_on_task
    n_jobs=n_jobs,
  File "/home/feurerm/sync_dir/projects/openml/python/openml/runs/functions.py", line 228, in run_flow_on_task
    flow_id = flow_exists(flow.name, flow.external_version)
  File "/home/feurerm/sync_dir/projects/openml/python/openml/flows/functions.py", line 256, in flow_exists
    "flow/exists", "post", data={"name": name, "external_version": external_version},
  File "/home/feurerm/sync_dir/projects/openml/python/openml/_api_calls.py", line 67, in _perform_api_call
    response = __read_url(url, request_method, data)
  File "/home/feurerm/sync_dir/projects/openml/python/openml/_api_calls.py", line 206, in __read_url
    request_method=request_method, url=url, data=data, md5_checksum=md5_checksum
  File "/home/feurerm/sync_dir/projects/openml/python/openml/_api_calls.py", line 237, in _send_request
    __check_response(response=response, url=url, file_elements=files)
  File "/home/feurerm/sync_dir/projects/openml/python/openml/_api_calls.py", line 284, in __check_response
    raise __parse_server_exception(response, url, file_elements=file_elements)
openml.exceptions.OpenMLServerException: https://test.openml.org/api/v1/xml/flow/exists returned code 102: No authentication (Please provide API key for all requests other than HTTP GET) - None

Process finished with exit code 1

Something like

The API call https://test.openml.org/api/v1/xml/flow/exists requires authentication via an API key. Please configure OpenML-Python to use your API as described in this example: https://openml.github.io/openml-python/main/examples/20_basic/introduction_tutorial.html#authentication

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions