mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
chore: remove uses of six.PY2 in codebase (#25062)
* remove uses of six.py2 in codebase * changes based on pr feedback * Update amazon_mws_api.py Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import urllib
|
||||
from urllib.parse import quote
|
||||
import hashlib
|
||||
import hmac
|
||||
import base64
|
||||
@@ -68,8 +69,9 @@ def calc_md5(string):
|
||||
"""
|
||||
md = hashlib.md5()
|
||||
md.update(string)
|
||||
return base64.encodestring(md.digest()).strip('\n') if six.PY2 \
|
||||
else base64.encodebytes(md.digest()).decode().strip()
|
||||
return base64.encodebytes(md.digest()).decode().strip()
|
||||
|
||||
|
||||
|
||||
def remove_empty(d):
|
||||
"""
|
||||
@@ -177,7 +179,6 @@ class MWS(object):
|
||||
'SignatureMethod': 'HmacSHA256',
|
||||
}
|
||||
params.update(extra_data)
|
||||
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, quote(signature))
|
||||
|
||||
Reference in New Issue
Block a user