make auth_header optional to enable using _request_session.headers #632
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.
Before this PR
requests
provides a convenient Session object that allows headers to be shared across all requests made with a given session.conjure-python
initializes all services with a requests.Session() object, but also created a non-optionalauth-header
field for all generated methods that require header authentication. Even if the auth header is specified in the Session object, it will not be respected and must be provided for every method call. This PR modifies the generation code to ensure that headers are optional, and will override the Service._request_session.headers object only if specifiedAfter this PR
==COMMIT_MSG==
Required headers are now optional when calling methods and can instead be provided in the
requests.Session.headers
dict. If headers are provided in the method, they will override the session headers.==COMMIT_MSG==
Possible downsides?
The exception raised for missing required headers will change from a
TypeError
to the exception raised by requests