Skip to content

Commit 787e8eb

Browse files
committed
Don't catch any exceptions in the QR code generator function
1 parent 676fa5d commit 787e8eb

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='python-vipaccess',
9-
version='0.1.2',
9+
version='0.1.3',
1010
description="A free software implementation of Symantec's VIP Access application and protocol",
1111
long_description=readme,
1212
url='https://github.com/cyrozap/python-vipaccess',

vipaccess/utils.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,16 @@ def generate_otp_uri(token_id, secret):
225225

226226
def generate_qr_code(uri):
227227
'''Generate a QR code from the OTP URI.'''
228-
try:
229-
qr = qrcode.QRCode(
230-
version=1,
231-
error_correction=qrcode.constants.ERROR_CORRECT_L,
232-
box_size=10,
233-
border=4
234-
)
235-
qr.add_data(uri)
236-
qr.make(fit=True)
237-
im = qr.make_image()
238-
return im
239-
except:
240-
return False
228+
qr = qrcode.QRCode(
229+
version=1,
230+
error_correction=qrcode.constants.ERROR_CORRECT_L,
231+
box_size=10,
232+
border=4
233+
)
234+
qr.add_data(uri)
235+
qr.make(fit=True)
236+
im = qr.make_image()
237+
return im
241238

242239
def check_token(token_id, secret):
243240
'''Check the validity of the generated token.'''

0 commit comments

Comments
 (0)