Make the code python3 friendly

pull/2/merge
Raphaël Vinot 2015-05-03 02:47:47 +02:00
parent 59254c8246
commit b6ff8746bc
4 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,7 @@ destination = None
def init(cert_to_priv=True):
global source
global destination
print cert_to_priv
print(cert_to_priv)
if cert_to_priv:
source = PyMISP(url_cert, cert, cert_cert, 'xml')
destination = PyMISP(url_priv, priv, cert_priv, 'xml')
@ -63,22 +63,22 @@ def loop_copy():
def copy(eventid):
eventid = eventid.strip()
if len(eventid) == 0 or not eventid.isdigit():
print 'empty line or NaN.'
print('empty line or NaN.')
return
eventid = int(eventid)
print eventid, 'copying...'
print(eventid, 'copying...')
r = copy_event(eventid)
if r.status_code >= 400:
loc = r.headers['location']
if loc is not None:
event_to_update = loc.split('/')[-1]
print'updating', event_to_update
print('updating', event_to_update)
r = update_event(eventid, event_to_update)
if r.status_code >= 400:
print r.status_code, r.headers
print(r.status_code, r.headers)
else:
print r.status_code, r.headers
print eventid, 'done.'
print(r.status_code, r.headers)
print(eventid, 'done.')
def export_our_org():

View File

@ -74,7 +74,7 @@ def get_event(event_id):
else:
continue
else:
print "Not a valid ID"
print("Not a valid ID")
return
@ -109,16 +109,16 @@ def print_events():
if app_ip_src == True:
for ip in network_ip_src:
print ip[0]
print(ip[0])
if app_ip_dst == True:
for ip in network_ip_dst:
print ip[0]
print(ip[0])
if app_domain == True:
for ip in network_domain:
print ip[0]
print(ip[0])
if app_hostname == True:
for ip in network_hostname:
print ip[0]
print(ip[0])
if __name__ == '__main__':
@ -164,5 +164,5 @@ if __name__ == '__main__':
get_event( event_id.strip() )
print_events()
else:
print "No filename given, stopping."
print("No filename given, stopping.")

View File

@ -1 +1 @@
from api import PyMISP
from .api import PyMISP

View File

@ -53,7 +53,7 @@ class PyMISP(object):
return query
url = self.rest.format(path)
query = {'request': query}
print json.dumps(query)
print(json.dumps(query))
r = session.post(url, data=json.dumps(query))
return r.json()