Skip to content

added trust_env attribute on the client instance - #187

Merged
sethmlarson merged 3 commits into
encode:masterfrom
cansarigol:netrc-185
Aug 17, 2019
Merged

sethmlarson merged 3 commits into
encode:masterfrom
cansarigol:netrc-185

Conversation

@cansarigol

@cansarigol cansarigol commented Aug 1, 2019 •

Copy link
Copy Markdown
Contributor

Closes #185

Comment thread httpx/api.py Outdated
trust_env: bool = None,
) -> Response:
with Client() as client:
with Client(trust_env=trust_env) as client:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest passing trust_env in the request call here, instead. That'd feel more obvious to me.

Comment thread httpx/client.py
cert: CertTypes = None,
verify: VerifyTypes = None,
timeout: TimeoutTypes = None,
trust_env: bool = True,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to get rid of trust_env here - we just want to change the behavior so that if trust_env == None then the client default is used, but if trust_env in (True, False) then the explicitly requested behaviour is used.

@lovelydinosaur

Copy link
Copy Markdown
Member

Typically I'd suggest keeping pull requests for #185 and #186 seperate - that makes for more easily reviewable chunks of work, and means we can progress one, even if the other is blocked.

@cansarigol
cansarigol force-pushed the netrc-185 branch 2 times, most recently from c197449 to 3854125 Compare August 1, 2019 16:57
@cansarigol

Copy link
Copy Markdown
Contributor Author

Sorry, I thought you want to move trust_env into BaseClient.__init__.
I separated PRs.

@sethmlarson sethmlarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, can we get one test case that verifies that setting client.request(..., trust_env=X) overrides client.trust_env?

@cansarigol

Copy link
Copy Markdown
Contributor Author

Code looks good, can we get one test case that verifies that setting client.request(..., trust_env=X) overrides client.trust_env?

Could you review again? I added a test that contains trust_env=True. False case already existed.

@sethmlarson sethmlarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a tiny bit to your test case. If CI passes we're good to go!

@sethmlarson
sethmlarson merged commit 04d5ffb into encode:master Aug 17, 2019
@sethmlarson

Copy link
Copy Markdown
Contributor

Thanks @cansarigol! :D

@cansarigol

Copy link
Copy Markdown
Contributor Author

You're welcome

@cansarigol
cansarigol deleted the netrc-185 branch August 17, 2019 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support .trust_env attribute on the client instance.

3 participants