correct codecov

pull/193/head
Sebdraven 2018-06-11 13:34:45 +02:00
parent 755d907580
commit 14695bbeb9
1 changed files with 20 additions and 19 deletions

View File

@ -19,31 +19,32 @@ moduleinfo = {'version': '1', 'author': 'Sebastien Larinier @sebdraven',
moduleconfig = ['apikey'] moduleconfig = ['apikey']
def handler(q=False): def handler(q=False):
if q is False: if q:
return False
request = json.loads(q)
if not request.get('config') and not (request['config'].get('apikey')): request = json.loads(q)
misperrors['error'] = 'Onyphe authentication is missing'
return misperrors
api = Onyphe(request['config'].get('apikey')) if not request.get('config') and not (request['config'].get('apikey')):
misperrors['error'] = 'Onyphe authentication is missing'
return misperrors
if not api: api = Onyphe(request['config'].get('apikey'))
misperrors['error'] = 'Onyphe Error instance api'
ip = '' if not api:
if request.get('ip-src'): misperrors['error'] = 'Onyphe Error instance api'
ip = request['ip-src']
elif request.get('ip-dst'): ip = ''
ip = request['ip-dst'] if request.get('ip-src'):
ip = request['ip-src']
elif request.get('ip-dst'):
ip = request['ip-dst']
else:
misperrors['error'] = "Unsupported attributes type"
return misperrors
return handle_expansion(api, ip, misperrors)
else: else:
misperrors['error'] = "Unsupported attributes type" return False
return misperrors
return handle_expansion(api, ip, misperrors)
def handle_expansion(api, ip, misperrors): def handle_expansion(api, ip, misperrors):