From 63bea8e2a6c2c5c2ec659e21e1fb44e02002f466 Mon Sep 17 00:00:00 2001 From: "Miguel A. Munoz" Date: Tue, 3 Sep 2019 17:45:01 +0200 Subject: [PATCH] Suggested changes by Qalthos --- lib/ansible/plugins/httpapi/fortios.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/ansible/plugins/httpapi/fortios.py b/lib/ansible/plugins/httpapi/fortios.py index 5c38bddf490..925367d7801 100644 --- a/lib/ansible/plugins/httpapi/fortios.py +++ b/lib/ansible/plugins/httpapi/fortios.py @@ -46,7 +46,6 @@ from ansible.module_utils.basic import to_text from ansible.module_utils.six.moves import urllib import json import re -import sys class HttpApi(HttpApiBase): @@ -66,11 +65,7 @@ class HttpApi(HttpApiBase): def login(self, username, password): """Call a defined login endpoint to receive an authentication token.""" - if sys.version_info[0] >= 3: - data = "username=" + urllib.parse.quote(username) + "&secretkey=" + urllib.parse.quote(password) + "&ajax=1" - else: - data = "username=" + urllib.quote(username) + "&secretkey=" + urllib.quote(password) + "&ajax=1" - + data = "username=" + urllib.parse.quote(username) + "&secretkey=" + urllib.parse.quote(password) + "&ajax=1" dummy, result_data = self.send_request(url='/logincheck', data=data, method='POST') if result_data[0] != '1': raise Exception('Wrong credentials. Please check')