Be sure to import urllib.parse from somewhere
This commit is contained in:
parent
fc486824b8
commit
8ba0af5df3
1 changed files with 5 additions and 2 deletions
|
@ -30,6 +30,9 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
import ansible.module_utils.six
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: uri
|
||||
|
@ -265,7 +268,7 @@ def write_file(module, url, dest, content):
|
|||
|
||||
|
||||
def url_filename(url):
|
||||
fn = os.path.basename(urlparse.urlsplit(url)[2])
|
||||
fn = os.path.basename(six.moves.urllib.parse.urlsplit(url)[2])
|
||||
if fn == '':
|
||||
return 'index.html'
|
||||
return fn
|
||||
|
@ -280,7 +283,7 @@ def absolute_location(url, location):
|
|||
return location
|
||||
|
||||
elif location.startswith('/'):
|
||||
parts = urlparse.urlsplit(url)
|
||||
parts = six.moves.urllib.parse.urlsplit(url)
|
||||
base = url.replace(parts[2], '')
|
||||
return '%s%s' % (base, location)
|
||||
|
||||
|
|
Loading…
Reference in a new issue