fix: Python 3 fixes for MWS Connector (#18986)

diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
index 1c39d88..b9be9c0 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
@@ -89,8 +89,6 @@
 			end_date=end_date,
 			marketplaceids=marketplaceids)
 
-	#add time delay to wait for amazon to generate report
-	time.sleep(20)
 	report_request_id = report_response.parsed["ReportRequestInfo"]["ReportRequestId"]["value"]
 	generated_report_id = None
 	#poll to get generated report
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
index cc4ccc5..68c2b9c 100755
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
@@ -10,6 +10,7 @@
 import hashlib
 import hmac
 import base64
+import six
 from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
 import re
 try:
@@ -77,6 +78,7 @@
 	return d
 
 def remove_namespace(xml):
+	xml = xml.decode('utf-8')
 	regex = re.compile(' xmlns(:ns2)?="[^"]+"|(ns2:)|(xml:)')
 	return regex.sub('', xml)
 
@@ -172,9 +174,10 @@
 			'SignatureMethod': 'HmacSHA256',
 		}
 		params.update(extra_data)
-		request_description = '&'.join(['%s=%s' % (k, urllib.quote(params[k], safe='-_.~').encode('utf-8')) for k in sorted(params)])
+		quote = urllib.quote if six.PY2 else urllib.parse.quote
+		request_description = '&'.join(['%s=%s' % (k, quote(params[k], safe='-_.~')) for k in sorted(params)])
 		signature = self.calc_signature(method, request_description)
-		url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, urllib.quote(signature))
+		url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, quote(signature))
 		headers = {'User-Agent': 'python-amazon-mws/0.0.1 (Language=Python)'}
 		headers.update(kwargs.get('extra_headers', {}))
 
@@ -218,7 +221,10 @@
 		"""Calculate MWS signature to interface with Amazon
 		"""
 		sig_data = method + '\n' + self.domain.replace('https://', '').lower() + '\n' + self.uri + '\n' + request_description
-		return base64.b64encode(hmac.new(str(self.secret_key), sig_data, hashlib.sha256).digest())
+		sig_data = sig_data.encode('utf-8')
+		secret_key = self.secret_key.encode('utf-8')
+		digest = hmac.new(secret_key, sig_data, hashlib.sha256).digest()
+		return base64.b64encode(digest).decode('utf-8')
 
 	def get_timestamp(self):
 		"""