-
Notifications
You must be signed in to change notification settings - Fork 335
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
feat: Add possibility to use None as no proxy in tiered proxies #760
Conversation
Add tests for it. Update docs. Unrelated: Also delete ignore that was no longer needed.
@@ -85,7 +85,7 @@ def __init__( | |||
the proxy selection mechanism. | |||
""" | |||
self._next_custom_url_index = 0 | |||
self._used_proxy_urls = dict[str, URL]() | |||
self._used_proxy_urls = dict[str, Union[URL, None]]() |
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.
Mypy was very aggressive when I wanted to use | on this specific line. I got bullied into using Union
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.
Yeah, AFAIK in generics the pipe is still not possible
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.
Pull request is neither linked to an issue or epic nor labeled as adhoc!
|
||
|
||
async def test_rotates_proxies_uniformly_with_no_request_no_proxy() -> None: | ||
"""Not sure how real is this use case, but it is supported.""" |
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.
Should I keep this test? I am not even sure if this usecase makes much sense.
Remove unrelated pyproject change as it was done in different PR.
Looking good to me 👏🏽 (I'm glad to see this really was as simple as in the JS version). Have you tested this locally with a crawler (i.e. won't other parts of Crawlee mind the |
I tested running
I am not sure what you mean by "Do we already support this case with |
Ok I think I get it. I looked only at tiered proxies. Currently this will still not work:
I will make it work consistently for all possible ways of setting the proxies to None |
Right, sorry, I might have been confusing - in JS version, we support the
Sounds good! (and hopefully not too much work 🤞🏽 ) |
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.
Just one note about the test documentation; otherwise, it looks good. Thanks.
Using None in input lists for tiered proxy configuration will be interpreted as no proxy. This allows to have for example lowest tier without proxy.
Add tests for it.
Update docs.
tieredProxyUrls
acceptnull
for switching the proxy off #687