-
-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore PermissionError in netrc_info() #810
Conversation
I'm running uWSGI, the user is "nobody", the netrc_file should be '~/.netrc'. But I don't know why, the location trunes out to be '/root/.netrc', so a PermissionError raised, it's better to ignore this error instead of to raise.
Okay. It's not super clear if it'd be better for us to ignore this, or to raise it, to ensure the user is aware of the issue. You can disable I suppose we should probably follow requests' lead here and silently ignore The build on this pull request is currently failing due to linter errors - make sure to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A couple of suggestions from me.
@Jonney Also, were you able to debug this by using the |
It's ugly to use trust_env=False every time, if so, I want to use Requests instead of httpx |
Yes, it is. You can use a client = httpx.Client(trust_env=False)
response = client.get('https://example.org') async with httpx.AsyncClient(trust_env=False) as client:
response = await client.get('https://example.org')
Also, that suggestion was meant as a workaround, not a permanent solution. |
ignore (netrc.NetrcParseError, IOError, PermissionError)
Co-Authored-By: Stephen Brown II <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're almost there! A suggestion to simplify things a bit.
Note that the CI build is failing due to a missing type annotation on raise_errors
, but dropping this parameter should make the lint error go away too. :-)
Co-Authored-By: Florimond Manca <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks so much! Now closed, see #1104 |
I'm running uWSGI, the user is "nobody", the netrc_file should be '~/.netrc'.
But I don't know why, the location trunes out to be '/root/.netrc', so a PermissionError raised, it's better to ignore this error instead of to raise.