digital-science / dimcli

Python client and CLI for scientometrics and research analytics using the Dimensions API.
https://digital-science.github.io/dimcli/getting-started.html
MIT License
43 stars 6 forks source link

Capture expired token login #77

Open maltevogl opened 1 year ago

maltevogl commented 1 year ago

I am working on an interface for visualizing references and citations relations using the Dimensions API and have an edge case where I can not capture an expired login token. The message returned starts from this line https://github.com/digital-science/dimcli/blob/5e68103a80f503e35c457de6f3361530b0719915/dimcli/core/api.py#L157 I would like to capture an error from dimcli.login(key=api_key) but instead the routine tries again to login with the expired token (self._refresh_login()).

What is the reason behind retrying after an 403 error? Could you give me any input on how to capture this? My code is here: https://gitlab.gwdg.de/modelsen/semanticlayertools/-/blob/main/src/semanticlayertools/visual/citationnet.py#L24