1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-16 02:23:11 +08:00

[utils] Make random_ipv4 return unicode string

This commit is contained in:
Sergey M․ 2017-02-04 20:26:43 +07:00
parent 463509741e
commit 9b49e07039
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -3290,8 +3290,8 @@ class GeoUtils(object):
addr, preflen = block.split('/')
addr_min = compat_struct_unpack('!L', socket.inet_aton(addr))[0]
addr_max = addr_min | (0xffffffff >> int(preflen))
return socket.inet_ntoa(
compat_struct_pack('!I', random.randint(addr_min, addr_max)))
return compat_str(socket.inet_ntoa(
compat_struct_pack('!I', random.randint(addr_min, addr_max))))
class PerRequestProxyHandler(compat_urllib_request.ProxyHandler):