ValueError: tie between ipv6 and ipv4
choesy opened this issue · comments
I get an error if I run the public_ip.get() function multiple times in a row:
ValueError: tie between ipv6 and ipv4 among the responses ({first_votes} occurrences each)
the problem is that it is returning ipv6 ips. I only want ipv4. Can this be fixed?
Found out that https://ifconfig.co/ip and https://icanhazip.com/ return ipv6. So i am removing them from the list in my script.
Thanks for reporting this. However, I cannot reproduce this error: both sides show an IPv4 for me. We'd need to determine first why you're seeing different formats being returned by these websites.
Furthermore: it those two sites are returning IPv6, that would still leave four votes for the IPv4. A tie implies that at least two of the requests to the other servers failed.
I discovered that the problem occurred in a house with a router where ipv6 was supported. In that case, I guess the two links I mentioned in my first comment return the ipv6 instead of ipv4. Besides that, I do not know why, but I get three different ips when I run the .get() function successively. First I get an IP that looks like xxx.xxx.0.xxx, then I get xxx.xxx.100.xxx (0 changed to 100, rest of the IP is same), and then after more tries, the error that includes ipv6 in the message occurs (the one in the issue). Maybe the error is specific to where I live. Because now on public wifi, the .get() function runs just fine.