Fixed import of urlencode and pathname2url from urllib for python3 (#24424)

This commit is contained in:
Michael 2017-05-19 17:22:16 +00:00 committed by Matt Martz
parent 98a8b967d2
commit b65ebf3519
26 changed files with 66 additions and 69 deletions

View file

@ -79,9 +79,10 @@ except ImportError:
# Let snippet from module_utils/basic.py return a proper error in this case
pass
import urllib
import time
from ansible.module_utils.six.moves.urllib.parse import urlencode
API_BASE = "http://api.uptimerobot.com/"
API_ACTIONS = dict(
@ -97,7 +98,7 @@ SUPPORTS_CHECK_MODE = False
def checkID(module, params):
data = urllib.urlencode(params)
data = urlencode(params)
full_uri = API_BASE + API_ACTIONS['status'] + data
req, info = fetch_url(module, full_uri)
result = req.read()
@ -109,7 +110,7 @@ def checkID(module, params):
def startMonitor(module, params):
params['monitorStatus'] = 1
data = urllib.urlencode(params)
data = urlencode(params)
full_uri = API_BASE + API_ACTIONS['editMonitor'] + data
req, info = fetch_url(module, full_uri)
result = req.read()
@ -121,7 +122,7 @@ def startMonitor(module, params):
def pauseMonitor(module, params):
params['monitorStatus'] = 0
data = urllib.urlencode(params)
data = urlencode(params)
full_uri = API_BASE + API_ACTIONS['editMonitor'] + data
req, info = fetch_url(module, full_uri)
result = req.read()