mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
[utils] Make random_ipv4 return unicode string
This commit is contained in:
parent
5d3fbf77d9
commit
18a0defab0
@ -3290,8 +3290,8 @@ def random_ipv4(cls, code):
|
|||||||
addr, preflen = block.split('/')
|
addr, preflen = block.split('/')
|
||||||
addr_min = compat_struct_unpack('!L', socket.inet_aton(addr))[0]
|
addr_min = compat_struct_unpack('!L', socket.inet_aton(addr))[0]
|
||||||
addr_max = addr_min | (0xffffffff >> int(preflen))
|
addr_max = addr_min | (0xffffffff >> int(preflen))
|
||||||
return socket.inet_ntoa(
|
return compat_str(socket.inet_ntoa(
|
||||||
compat_struct_pack('!I', random.randint(addr_min, addr_max)))
|
compat_struct_pack('!I', random.randint(addr_min, addr_max))))
|
||||||
|
|
||||||
|
|
||||||
class PerRequestProxyHandler(compat_urllib_request.ProxyHandler):
|
class PerRequestProxyHandler(compat_urllib_request.ProxyHandler):
|
||||||
|
Loading…
Reference in New Issue
Block a user