python3 changes

pull/96/head
Joerg Stephan 2017-01-31 16:34:41 +01:00
parent 03044e1e6a
commit dad73feaa4
1 changed files with 9 additions and 13 deletions

View File

@ -1,6 +1,4 @@
#!/usr/bin/python import requests
import urllib2
import json import json
import sys import sys
@ -71,19 +69,17 @@ def handler(q=False):
return r return r
def apicall(indicator_type, indicator, key=False): def apicall(indicator_type, indicator, key=False):
try: #try:
myURL = BASEurl + (extensions[str(indicator_type)])%indicator myURL = BASEurl + (extensions[str(indicator_type)])%indicator
request = urllib2.Request(myURL, None, MyHeader(key)) jsondata = requests.get(myURL, headers=MyHeader(key)).json()
data = urllib2.urlopen(request) #except:
jsondata = json.loads(data.read()) #return None
except: return jsondata
return None
return jsondata
def introspection(): def introspection():
return mispattributes return mispattributes
def version(): def version():
moduleinfo['config'] = moduleconfig moduleinfo['config'] = moduleconfig
return moduleinfo return moduleinfo