Make URLLibFetcher aware of basic auth info in scheduler URL. #2791
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR makes
luigi.rpc.URLLibFetcher
aware of basic auth infos encoded in the scheduler URL so that a validAuthorization
header for basic auth is added to the request.Motivation and Context
We are running luigid behind an nginx proxy with basic auth (docker image). User and password are defined right in the
[core] default-scheduler-host
config value, e.g.,"http://user:pass@localhost"
.When the
requests
package is available,luigi.rpc.RequestsFetcher
is used which automatically extracts this information and creates theAuthorization
header for basic auth whensession.post()
is called.The fallback,
URLLibFetcher
, does not do that.urllib2.urlopen
responds withThis PR adds that feature so that the behavior is as expected and in particular independent of the presence of
requests
.Have you tested this? If so, how?
I added unit tests to check if the created request object contains the correct auth header for multiple use cases. Also I tested again with the docker image above and everything works as expected.