chg: [qrcode] various fixes to make it PEP compliant

pull/302/head
Alexandre Dulaunoy 2019-04-23 14:37:27 +02:00
parent a0fce1bc90
commit d5180e7e79
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@ cryptocurrencies = {'bitcoin'}
schemas = {'http://', 'https://', 'ftp://'}
moduleconfig = []
def handler(q=False):
if q is False:
return False
@ -27,7 +28,7 @@ def handler(q=False):
filename = q['attachment']
try:
img_array = np.fromstring(binascii.a2b_base64(q['data']), np.uint8)
except:
except Exception as e:
err = "Couldn't fetch attachment (JSON 'data' is empty). Are you using the 'Query enrichment' action?"
misperrors['error'] = err
print(err)
@ -46,7 +47,7 @@ def handler(q=False):
for item in cryptocurrencies:
if item in result:
try:
currency, address, extra = re.split('\:|\?', result)
currency, address, extra = re.split('\:|\?', result)
except Exception as e:
print(e)
if currency in cryptocurrencies:
@ -60,7 +61,7 @@ def handler(q=False):
print(e)
else:
print(address)
for item in schemas:
for item in schemas:
if item in result:
try:
url = result
@ -77,6 +78,7 @@ def handler(q=False):
misperrors['error'] = "Couldn't decode QR code in attachment."
return misperrors
def introspection():
return mispattributes