summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntanas Uršulis <antanas.ursulis@gmail.com>2013-07-05 02:18:44 +0300
committerAntanas Uršulis <antanas.ursulis@gmail.com>2013-07-05 02:18:44 +0300
commitadecdbc1cd849ca19fbccf2c189f676d54b51e85 (patch)
tree2f7ba57579c82fea03b99bebf74c286ab629fc28 /simple_client.py
parent'clean' target update (diff)
downloadlog-analysis-adecdbc1cd849ca19fbccf2c189f676d54b51e85.tar.gz
log-analysis-adecdbc1cd849ca19fbccf2c189f676d54b51e85.tar.bz2
log-analysis-adecdbc1cd849ca19fbccf2c189f676d54b51e85.zip
Group logs by source hostname and add multiple-file submissions
Diffstat (limited to 'simple_client.py')
-rw-r--r--simple_client.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/simple_client.py b/simple_client.py
index bbd7835..0335260 100644
--- a/simple_client.py
+++ b/simple_client.py
@@ -4,16 +4,19 @@ Simple submission client that forms a correct protobuf message and performs a PO
import submission_pb2, sys, urllib
-def send_submission(filename):
+def send_submission(filenames):
submission = submission_pb2.Submission()
- submission.filename = filename
- submission.data = open(filename, 'rb').read()
+
+ for f in filenames:
+ new_file = submission.files.add()
+ new_file.filename = f
+ new_file.data = open(f, 'rb').read()
print urllib.urlopen('http://[::1]:5000/submit', submission.SerializeToString()).read()
if __name__ == '__main__':
- if len(sys.argv) != 2:
- sys.stderr.write('usage: ' + sys.argv[0] + ' FILENAME\n')
+ if len(sys.argv) < 2:
+ sys.stderr.write('usage: ' + sys.argv[0] + ' FILENAMES\n')
sys.exit(-1)
- send_submission(sys.argv[1])
+ send_submission(sys.argv[1:])