-
Notifications
You must be signed in to change notification settings - Fork 4
Allow for proxy_count of exact 0 #19
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
Conversation
python_ipware/python_ipware.py
Outdated
|
||
# the incoming ips match our proxy count | ||
if self.proxy_count > 0 and proxy_count_validated: | ||
if self.proxy_count and self.proxy_count > 0 and proxy_count_validated: |
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.
Here I would just check if self.proxy_count is not None and proxy_count_validated
because self.proxy_count = 0 now also means that the proxy_count did go through validation. If I change this, I have to adapt the tests test_proxy_count_zero_dont_care_proxy_pass
and test_proxy_count_zero_exact_zero_proxy_pass
.
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.
Great catch! thx
python_ipware/python_ipware.py
Outdated
precedence: Optional[Tuple[str, ...]] = None, | ||
leftmost: bool = True, | ||
proxy_count: int = 0, | ||
leftmost: Optional[bool] = True, |
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.
I'm not sure why you make leftmost
an Optional[bool]
. Passing leftmost=None
seems to have the same effect as leftmost=False
.
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.
Typing stuff. It is a boolean.
Allow for proxy_count of exact 0