mirror of https://github.com/MISP/PyMISP
fix event_add, add example
parent
483f7839c0
commit
b53dac7773
|
@ -9,7 +9,7 @@ import requests
|
|||
class PyMISP(object):
|
||||
|
||||
def __init__(self, url, key, out_type = 'json'):
|
||||
self.url = url
|
||||
self.url = url + '/events'
|
||||
self.key = key
|
||||
self.out_type = out_type
|
||||
self.rest = self.url + '/{}'
|
||||
|
@ -25,7 +25,8 @@ class PyMISP(object):
|
|||
out = self.out_type
|
||||
session = requests.Session()
|
||||
session.headers.update({'Authorization': self.key,
|
||||
'Accept': 'application/' + out})
|
||||
'Accept': 'application/' + out,
|
||||
'content-type': 'text/' + out})
|
||||
return session
|
||||
|
||||
|
||||
|
@ -38,7 +39,7 @@ class PyMISP(object):
|
|||
Warning, there's a limit on the number of results
|
||||
"""
|
||||
session = self.__prepare_session()
|
||||
return session.get(self.url, verify=False)
|
||||
return session.get(self.rest, verify=False)
|
||||
|
||||
def get_event(self, event_id):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from api import *
|
||||
|
||||
|
||||
key_source = 'ExrJUE1UehwOWFM5FQbfNGpHTXXzWGsAeTk9ym3M'
|
||||
url_source = 'https://misp.circl.lu/events'
|
||||
|
||||
|
||||
key_dest = 'vmDndechmTUHHqsm2fsAJmmr29mOPuIkQlH4ATlW'
|
||||
url_dest = 'https://misppriv.circl.lu/events'
|
||||
|
||||
init_server(url_source, key_source)
|
||||
|
||||
r = get_event(709)
|
||||
source_data = unicode(r.json())
|
||||
|
||||
#init_server(url_dest, key_dest)
|
||||
|
||||
print source_data
|
||||
|
||||
#r = add_event(source_data.encode('utf-8'))
|
||||
|
||||
#print r.text
|
||||
|
Loading…
Reference in New Issue