Closed deronnax closed 1 year ago
First, the credentials in the URL are provided incorrectly and unearth rejects them, you should include a :
to split username and password, even any part is empty.
And if the credentials in the URL are not valid, there is no need to extract them from the URL again, that's why it is OK to use resp.url
with the auth part stripped.
- either
_get_new_credetials
should be called first withallow_netrc
/allow_keyring
set to True
Yes, that is done in #75
Describe the bug
unearth asks for the login whereas it's provided in the index url:
We found out the root cause, see additional context
To Reproduce
Expected behavior unearth should not ask for the login and use the provided username
Screenshots If applicable, add screenshots to help explain your problem.
System (please complete the following information):
irrelevant
Additional context
We found out why it happens: At first,
_get_new_credentials
is called, withallow_netrc
andallow_keyring
set to false. Then unearth will receive a 401, and retry inhandle_400s
, but getting the url from theResponse
object, from which the username will have been stripped away from the url (see foot note). We found out that changing the first call to_get_new_credentials
to setallow_netrc
/allow_keyring
to True works as expected (the username is extracted from the netrc/keyring and the query succeed without prompting the user). So, possible fixes are :_get_new_credetials
should be called first withallow_netrc
/allow_keyring
set to Truehandle_400s
and if so get it backhttps://github.com/frostming/unearth/blob/66b32c9c1bd68b7cd3ce630b4fb2166c02366f51/src/unearth/auth.py#L238