diff options
author | Antanas Uršulis <antanas.ursulis@gmail.com> | 2013-07-03 00:28:45 +0100 |
---|---|---|
committer | Antanas Uršulis <antanas.ursulis@gmail.com> | 2013-07-03 00:28:45 +0100 |
commit | 4b161bb193dd40a6be29082d26586655c02e1cc4 (patch) | |
tree | 55a182577300dbe13fb2721bd87405b763e58fc1 | |
parent | Add simple submit POST method to flask app (diff) | |
download | log-analysis-4b161bb193dd40a6be29082d26586655c02e1cc4.tar.gz log-analysis-4b161bb193dd40a6be29082d26586655c02e1cc4.tar.bz2 log-analysis-4b161bb193dd40a6be29082d26586655c02e1cc4.zip |
Simple file submission client, based on urllib and protobuf
-rw-r--r-- | simple_client.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/simple_client.py b/simple_client.py new file mode 100644 index 0000000..bbd7835 --- /dev/null +++ b/simple_client.py @@ -0,0 +1,19 @@ +""" +Simple submission client that forms a correct protobuf message and performs a POST +""" + +import submission_pb2, sys, urllib + +def send_submission(filename): + submission = submission_pb2.Submission() + submission.filename = filename + submission.data = open(filename, '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') + sys.exit(-1) + + send_submission(sys.argv[1]) |