From c2d0758f1b8cf56795416758f1d2bf9c838cee73 Mon Sep 17 00:00:00 2001 From: vansh aggarwal Date: Sun, 5 Nov 2023 02:31:19 +0530 Subject: [PATCH] fixed --- openam.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openam.py b/openam.py index 7914c63..e1b7ce8 100644 --- a/openam.py +++ b/openam.py @@ -17,9 +17,9 @@ __version__ = '1.1.0' import urllib -import urllib2 +import urllib.request as urllib2 import json -import urlparse +import urllib.parse as urlparse # REST API URIs REST_OPENAM_LOGIN = '/identity/json/authenticate' @@ -294,9 +294,10 @@ def http_get(url, data, timeout): Send a simple HTTP GET and attempt to return the response data. """ - params = urllib.urlencode(data) + params = urllib.parse.urlencode(data).encode("utf-8") try: - resp = urllib2.urlopen(url, data=params, timeout=timeout) + req = urllib2.Request(url) + resp = urllib2.urlopen(req, data=params, timeout=timeout) except urllib2.HTTPError: return ''