From 0bb1ab5c5dc97466a931d3675b97bd9e2e149b41 Mon Sep 17 00:00:00 2001 From: Chris Davis <44245221+thedatadavis@users.noreply.github.com> Date: Thu, 24 Oct 2019 00:02:00 -0400 Subject: [PATCH] Replaced deprecated methods for Python 3.x --- ...ingRestClient.py => ClickMeetingRestClientPy3.py} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename API/examples/Python/{ClickMeetingRestClient.py => ClickMeetingRestClientPy3.py} (93%) diff --git a/API/examples/Python/ClickMeetingRestClient.py b/API/examples/Python/ClickMeetingRestClientPy3.py similarity index 93% rename from API/examples/Python/ClickMeetingRestClient.py rename to API/examples/Python/ClickMeetingRestClientPy3.py index 8074d05..76ea8f0 100644 --- a/API/examples/Python/ClickMeetingRestClient.py +++ b/API/examples/Python/ClickMeetingRestClientPy3.py @@ -1,6 +1,6 @@ # ClickMeeting REST client -import urllib +import urllib, urllib.parse import json import requests import types @@ -8,13 +8,13 @@ class ClickMeetingRestClient: def __init__(self, params): - self.api_key = params['api_key'] if params.has_key('api_key') else None + self.api_key = params['api_key'] if 'api_key' in params else None formats = ['json', 'xml', 'js', 'printr'] - self.url = params['url'] if params.has_key('url') else 'https://api.clickmeeting.com/v1/' + self.url = params['url'] if 'url' in params else 'https://api.clickmeeting.com/v1/' - self.format = params['format'].lower() if params.has_key('format') and params['format'].lower() in formats else None + self.format = params['format'].lower() if 'format' in params and params['format'].lower() in formats else None def sendRequest(self, method, path, params = None, format_response = True, is_upload_file = False): @@ -145,7 +145,7 @@ def build_query_item(params, base_key=None): if(type(params).__name__ == 'dict'): for key, value in params.items(): if(base_key): - new_base = urllib.quote(unicode("%s[%s]" % (base_key, key))) + new_base = urllib.parse.quote(str("%s[%s]" % (base_key, key))) results += build_query_item(value, new_base) else: results += build_query_item(value, key) @@ -156,7 +156,7 @@ def build_query_item(params, base_key=None): else: results += build_query_item(value) else: - quoted_item = urllib.quote(unicode(params)) + quoted_item = urllib.parse.quote(str(params)) if(base_key): results.append("%s=%s" % (base_key, quoted_item)) else: