diff --git a/pymisp/api.py b/pymisp/api.py index 63c3d97..70af3cc 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -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): """ diff --git a/pymisp/export_import.py b/pymisp/export_import.py new file mode 100644 index 0000000..e811497 --- /dev/null +++ b/pymisp/export_import.py @@ -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 +