Skip to content
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

Parse returns "invalid" if referrer url netloc is a valid IP address #40

Open
kmbibic opened this issue Feb 27, 2017 · 0 comments
Open

Comments

@kmbibic
Copy link

kmbibic commented Feb 27, 2017

Currently, Referrer.parse returns type: "invalid" if the netlocation of the referrer URL is a valid IP address. Referrers like this are definitely valid, so in places where Referrer.parse is being used, we have to check for valid IP addresses in the netloc and explicitly set the type to "indirect" instead of "invalid" which isn't ideal.

For example:

url = "http://108.61.207.249/ga.php"
ref = Referrer.parse(url)
parsed_url = urlparse(url)

ref shows a type: "invalid", but if we run IP(parsed_url.netloc) (where IP is from IPy) and see that the IP address is valid and the referrer shouldn't be tagged as "invalid". As a result, we have to explicitly check for this case and overwrite the type to "indirect" when using Referrer.parse().

cc @CamDavidsonPilon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant