1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix get_url to work on Python 2.4

This commit is contained in:
Daniel Hokka Zakrisson 2013-01-29 18:57:02 +01:00
parent 03cf5b2777
commit 0243b7be7c

View file

@ -101,11 +101,13 @@ def url_do_get(module, url, dest):
info = dict(url=url, dest=dest)
r = None
parsed = urlparse.urlparse(url)
if '@' in parsed.netloc:
credentials = parsed.netloc.split('@')[0]
if '@' in parsed[1]:
credentials, netloc = parsed[1].split('@', 1)
if ':' in credentials:
username, password = credentials.split(':')
netloc = parsed.netloc.split('@')[1]
username, password = credentials.split(':', 1)
else:
username = credentials
password = ''
parsed = list(parsed)
parsed[1] = netloc