This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Fix handling of deprecated credentials in HTTPTransport#146
Open
blueyed wants to merge 3 commits intocore-api:masterfrom
Open
Fix handling of deprecated credentials in HTTPTransport#146blueyed wants to merge 3 commits intocore-api:masterfrom
blueyed wants to merge 3 commits intocore-api:masterfrom
Conversation
Author
|
Ping @tomchristie. |
|
@blueyed Why the I'd simply solve the issue by parsing diff --git a/coreapi/transports/http.py b/coreapi/transports/http.py
index a548024..2ee3337 100644
--- a/coreapi/transports/http.py
+++ b/coreapi/transports/http.py
@@ -339,17 +339,17 @@ class HTTPTransport(BaseTransport):
headers = {key.lower(): value for key, value in headers.items()}
if session is None:
session = requests.Session()
- if auth is not None:
- session.auth = auth
- if not getattr(session.auth, 'allow_cookies', False):
- session.cookies.set_policy(BlockAll())
-
if credentials is not None:
warnings.warn(
"The 'credentials' argument is now deprecated in favor of 'auth'.",
DeprecationWarning
)
- auth = DomainCredentials(credentials)
+ session.auth = DomainCredentials(credentials)
+ if auth is not None:
+ session.auth = auth
+ if not getattr(session.auth, 'allow_cookies', False):
+ session.cookies.set_policy(BlockAll())
+
if request_callback is not None or response_callback is not None:
warnings.warn(
"The 'request_callback' and 'response_callback' arguments are now deprecated. "
|
Author
|
@ruxkor It does not seem to be well-maintained currently though, but if somebody gets to merge fixes it would be good to have your alternative ready. |
Author
This is necessary to get the location of where the code is actually used, i.e. where it needs to be fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes core-api/coreapi-cli#19 (comment).