Skip to content

Commit eb6c00e

Browse files
committed
Fixed code formatting warnings
1 parent d296a36 commit eb6c00e

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

hyperwallet/utils/apiclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def doPut(self, partialUrl, data):
193193
data=json.dumps(data).encode('utf-8')
194194
)
195195

196-
def __getRequestData(data):
196+
def __getRequestData(self, data):
197197
'''
198198
If encryption is enabled try to encrypt request data, otherwise no action required.
199199

hyperwallet/utils/encryption.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
from jose import jws
1313

1414
from hyperwallet.exceptions import HyperwalletException
15-
try:
16-
from urlparse import urlparse
17-
except:
18-
from urllib.parse import urlparse
15+
from six.moves.urllib.parse import urlparse
1916

2017

2118
class Encryption(object):
@@ -121,17 +118,17 @@ def __getJwkKeySet(self, location):
121118
:returns:
122119
JWK key set found at given location.
123120
'''
124-
try:
125-
url = urlparse(location)
126-
if url.scheme and url.netloc and url.path:
127-
return requests.get(location).text
128-
raise HyperwalletException('Failed to parse url from string = ' + location)
129-
except:
130-
if os.path.isfile(location):
131-
with open(location) as f:
132-
return f.read()
133-
else:
134-
raise HyperwalletException('Wrong JWK key set location path = ' + location)
121+
try:
122+
url = urlparse(location)
123+
if url.scheme and url.netloc and url.path:
124+
return requests.get(location).text
125+
raise HyperwalletException('Failed to parse url from string = ' + location)
126+
except Exception as e:
127+
if os.path.isfile(location):
128+
with open(location) as f:
129+
return f.read()
130+
else:
131+
raise HyperwalletException('Wrong JWK key set location path = ' + location)
135132

136133
def __findJwkKeyByAlgorithm(self, jwkKeySet, algorithm):
137134
'''

0 commit comments

Comments
 (0)