55"""
66
77__title__ = "woocommerce-oauth"
8- __version__ = "2.1.1 "
8+ __version__ = "3.0.0 "
99__author__ = "Claudio Sanches @ Automattic"
1010__license__ = "MIT"
1111
1414from hmac import new as HMAC
1515from hashlib import sha1 , sha256
1616from base64 import b64encode
17-
18- try :
19- from urllib .parse import urlencode , quote , unquote , parse_qsl , urlparse
20- except ImportError :
21- from urllib import urlencode , quote , unquote
22- from urlparse import parse_qsl , urlparse
23-
24- try :
25- from collections import OrderedDict
26- except ImportError :
27- from ordereddict import OrderedDict
28-
17+ from collections import OrderedDict
18+ from urllib .parse import urlencode , quote , unquote , parse_qsl , urlparse
2919
3020class OAuth (object ):
3121 """ API Class """
@@ -57,7 +47,7 @@ def get_oauth_url(self):
5747
5848 query_string = urlencode (params )
5949
60- return "%s?%s" % ( url , query_string )
50+ return f" { url } ? { query_string } "
6151
6252 def generate_oauth_signature (self , params , url ):
6353 """ Generate OAuth Signature """
@@ -71,7 +61,7 @@ def generate_oauth_signature(self, params, url):
7161 for key , value in params .items ()]
7262
7363 query_string = "%26" .join (query_params )
74- string_to_sign = "%s&%s&%s" % ( self .method , base_request_uri , query_string )
64+ string_to_sign = f" { self .method } & { base_request_uri } & { query_string } "
7565
7666 consumer_secret = str (self .consumer_secret )
7767 if self .version not in ["v1" , "v2" ]:
0 commit comments