-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Adds support for passing User Agent headers and Proxies through env variables. #32
Conversation
Co-Authored-By: Stuart Mumford <stuart@cadair.com>
Can you also add some tests for this? |
Also, the tests are failing with the message |
I can write a test to check if the User-Agent header is being generated as required or not. |
Have a look at the other tests, I think it's possible to inspect the request received by the "server" in the tests. Not sure about the proxy though. |
So, I got the UA, proxy tests working, further, I found out that the HTTP UA has a proper protocol. The first white space-delimited word must be the software product name, with an optional slash and version designator. I changed it as such so that the server can actually extract meaningful information from it. Also, only the FTP tests are failing with the error message |
So, I got FTP the tests working! |
@wtbarnes could you help with testing the proxy setting here? |
I would, but am no longer at the institution where I initially encountered this problem 😅 |
I need advice on refactoring the mocking code. It needs |
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.
Looking good!
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.
Think this looks good. Anything else you think needs doing @Raahul-Singh ?
I think I found a problem. |
Similarly, proxy_header needs to be of type |
We can either pass these as args to the constructor or not support proxy_headers and proxy_auth, just the proxy_url |
People can still provide auth and headers as kwargs to We should also document both these features before we merge this PR. |
One more caveat is that right now I am assuming that the proxy URL has the environment variable name as |
Yep. That'll work. I'll remove these from the code and add the documentation about these features. |
Is there a "standard" name for a proxy env var? this suggests we should be using |
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.
Needs docs and thoughts on env var naming.
Should I add tests for explicitly passing |
I can't think of anything more that I can add to this. I think we covered most of the stuff. |
Co-Authored-By: Stuart Mumford <stuart@cadair.com>
You think it's ready? |
Let's see, we have:
I can't think of anything else that may be required. |
Do you reckon it's done? |
Yeah I think it looks good :) The next thing to do is to test out 1.1rc2 with sunpy so we can have people use this with sunpy. |
@Cadair Would this suffice?
Also, I need some help with testing the code as I do not fully understand how
aiohttp
works.