def feed():
b = StringIO.StringIO()
# Options for PyCurl
opts = ['X-HoneyDb-ApiId: ' + DB_API_ID, 'X-HoneyDb-ApiKey: ' + DB_API_KEY]
c.setopt(pycurl.HTTPHEADER, (opts))
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.URL, "https://riskdiscovery.com/honeydb/api/twitter-threat-feed")
c.setopt(c.WRITEDATA, b)
try:
c.perform()
except Exception as e:
print "\n[" + t.red("!") + "]Critical. An error was raised with the following message"
print e
os.system("clear")
print "\n\n[" + t.green("+") + "]Retrieved Threat Feed, formatting..."
time.sleep(1)
response_f = json.loads(b. getvalue())
pprint(response_f)
format = json.dumps(response_f, indent = 2)
with open('feed.log', 'ab') as outfile:
outfile.write(format)
outfile.close()
print "\n\nResults saved to 'feed.log' in the current directory"
评论列表
文章目录