diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py index f03c5f92dae5aa290166f72304f56e4e6daaa332..0136660409f1693f2cde9f4243c6b2f1c2d1e40b 100644 --- a/warden3/warden_client/warden_client.py +++ b/warden3/warden_client/warden_client.py @@ -14,7 +14,7 @@ from os import path from operator import itemgetter from sys import version_info -fix_logging_filename = str if version_info<(2, 7) else lambda(x): x +fix_logging_filename = str if version_info<(2, 7) else lambda x: x VERSION = "3.0-beta2" diff --git a/warden3/warden_client/warden_client_examples.py b/warden3/warden_client/warden_client_examples.py index a66262b2c8165e0419a7e9af3a85af5e69ee4334..909ee8f65cf950d5f4777416c5440af40ee9cd87 100755 --- a/warden3/warden_client/warden_client_examples.py +++ b/warden3/warden_client/warden_client_examples.py @@ -106,7 +106,7 @@ def gen_random_idea(client_name="cz.example.warden.test"): "Size": 46, "Ref": ["cve:CVE-%s-%s" % (randstr(string.digits, 4), randstr())], "ContentEncoding": "base64", - "Content": b64encode(randstr()) + "Content": b64encode(randstr(maxlen=128*1024)) } ], "Node": [ @@ -139,7 +139,7 @@ def main(): # idstore="MyClient.id", # name="cz.example.warden.test") - print "=== Debug ===" + print("=== Debug ===") info = wclient.getDebug() pprint(info) @@ -150,18 +150,18 @@ def main(): # If you want just to be informed, this is not necessary, just # configure logging correctly and check logs. if isinstance(info, Error): - print info + print(info) - print "=== Server info ===" + print("=== Server info ===") info = wclient.getInfo() - print "=== Sending 10 event(s) ===" + print("=== Sending 10 event(s) ===") start = time() ret = wclient.sendEvents([gen_random_idea(client_name=wclient.name) for i in range(10)]) - print ret - print "Time: %f" % (time()-start) + print(ret) + print("Time: %f" % (time()-start)) - print "=== Getting 10 events ===" + print("=== Getting 10 events ===") start = time() # cat = ['Availability', 'Abusive.Spam','Attempt.Login'] @@ -181,11 +181,12 @@ def main(): group = [] nogroup = [] + ret = wclient.getEvents(count=0, id=0, cat=cat, nocat=nocat, tag=tag, notag=notag, group=group, nogroup=nogroup) ret = wclient.getEvents(count=10, cat=cat, nocat=nocat, tag=tag, notag=notag, group=group, nogroup=nogroup) - print "Time: %f" % (time()-start) - print "Got %i events" % len(ret) + print("Time: %f" % (time()-start)) + print("Got %i events" % len(ret)) for e in ret: - print e.get("Category"), e.get("Node")[0].get("Type"), e.get("Node")[0].get("Name") + print(e.get("Category"), e.get("Node")[0].get("Type"), e.get("Node")[0].get("Name")) if __name__ == "__main__": main()