Gentoo Archives: gentoo-commits

From: Antanas Ursulis <antanas.ursulis@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/log-analysis:master commit in: /
Date: Wed, 03 Jul 2013 07:15:52
Message-Id: 1372807725.4b161bb193dd40a6be29082d26586655c02e1cc4.uranium@gentoo
1 commit: 4b161bb193dd40a6be29082d26586655c02e1cc4
2 Author: Antanas Uršulis <antanas.ursulis <AT> gmail <DOT> com>
3 AuthorDate: Tue Jul 2 23:28:45 2013 +0000
4 Commit: Antanas Ursulis <antanas.ursulis <AT> gmail <DOT> com>
5 CommitDate: Tue Jul 2 23:28:45 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/log-analysis.git;a=commit;h=4b161bb1
7
8 Simple file submission client, based on urllib and protobuf
9
10 ---
11 simple_client.py | 19 +++++++++++++++++++
12 1 file changed, 19 insertions(+)
13
14 diff --git a/simple_client.py b/simple_client.py
15 new file mode 100644
16 index 0000000..bbd7835
17 --- /dev/null
18 +++ b/simple_client.py
19 @@ -0,0 +1,19 @@
20 +"""
21 +Simple submission client that forms a correct protobuf message and performs a POST
22 +"""
23 +
24 +import submission_pb2, sys, urllib
25 +
26 +def send_submission(filename):
27 + submission = submission_pb2.Submission()
28 + submission.filename = filename
29 + submission.data = open(filename, 'rb').read()
30 +
31 + print urllib.urlopen('http://[::1]:5000/submit', submission.SerializeToString()).read()
32 +
33 +if __name__ == '__main__':
34 + if len(sys.argv) != 2:
35 + sys.stderr.write('usage: ' + sys.argv[0] + ' FILENAME\n')
36 + sys.exit(-1)
37 +
38 + send_submission(sys.argv[1])