Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Authentication error when attempting to run example #9

Description

@CDaut

What I did:

  • python3 trigger_all.py
  • Enter the credentials

I got the following error message:

Traceback (most recent call last):
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/session.py", line 157, in _request_endpoint
    resp = await self._get_session().request(method, endpoint, **kwargs)
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/aiohttp/client.py", line 643, in _request
    resp.raise_for_status()
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='', url=URL('https://artemis-test.ipd.kit.edu/api/courses?onlyActive=false')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/clemens/repositorys/artemistats/artemis_client/examples/artemis_client_trigger_all/trigger_all.py", line 77, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/clemens/repositorys/artemistats/artemis_client/examples/artemis_client_trigger_all/trigger_all.py", line 33, in main
    courses = [x async for x in session.course.get_courses()]
  File "/home/clemens/repositorys/artemistats/artemis_client/examples/artemis_client_trigger_all/trigger_all.py", line 33, in <listcomp>
    courses = [x async for x in session.course.get_courses()]
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/managers/course.py", line 31, in get_courses
    resp = await self._session.get_api_endpoint("/courses", params=params)
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/session.py", line 105, in get_api_endpoint
    return await self._request_api_endpoint("get", api_endpoint, **kwargs)
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/session.py", line 174, in _request_api_endpoint
    return await self._request_endpoint(method, "/api" + api_endpoint, **kwargs)
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/session.py", line 165, in _request_endpoint
    self._token = await self._login()
  File "/home/clemens/repositorys/artemistats/venv/lib/python3.10/site-packages/artemis_client/session.py", line 145, in _login
    return resp.headers[AUTHORIZATION_HEADER]
KeyError: 'authorization'

From the error message I gather that it has something to do with the authentication when attempting to get the courses, which is curious because I verified the credentials in the Browser twice and the artemis client is able to construct a Session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions