Closed boxxello closed 2 years ago
@boxxello We've done some changes, can you try the latest version?
@bluet I'm sorry. I actually don't have that project anymore and I can't reproduce a minimal snippet cause it's been some time since I worked on that project.
@boxxello no worries. Thanks for this bug report, still. :+1:
I actually run into the same issue somehow
please make a minimal reproducible example
The following code results in this error:
import asyncio
from proxybroker import Broker
async def show(proxies):
while True:
proxy = await proxies.get()
if proxy is None: break
print('Found proxy: %s' % proxy)
proxies = asyncio.Queue()
broker = Broker(proxies)
tasks = asyncio.gather(
broker.find(types=['HTTP', 'HTTPS'], countries=["SG"], limit=10),
show(proxies))
loop = asyncio.get_event_loop()
loop.run_until_complete(tasks)
Any idea why?
found the issue in resolver.py line 51:
@staticmethod
def host_is_ip(host):
"""Check a host is IP address."""
# TODO: add IPv6 support
try:
ipaddress.IPv4Address(host)
except ipaddress.AddressValueError:
return False
else:
return True
>>> import ipaddress
>>> ipaddress.IPv4Address("1.09.74.59")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/ipaddress.py", line 1305, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/usr/local/lib/python3.10/ipaddress.py", line 1197, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Leading zeros are not permitted in '09' in '1.09.74.59'
>>> ipaddress.IPv4Address("1.9.74.59")
IPv4Address('1.9.74.59')
A ipaddress.AddressValueError
is also returned if the IP contains leading zeros.
As described by @br-olf , the issue is resolved by removing the leading zeros in an IP address. See #123
Hello, I'm having issues with the library, this is the stacktrace it threw:
and these are the functions, even shown in the examples I ran:
Could anyone help me with it?