From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id F1CEF138200 for ; Wed, 3 Jul 2013 07:15:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 26EEEE09A4; Wed, 3 Jul 2013 07:15:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B6E5CE09A4 for ; Wed, 3 Jul 2013 07:15:50 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ADE6833E838 for ; Wed, 3 Jul 2013 07:15:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 4DA5BE5462 for ; Wed, 3 Jul 2013 07:15:48 +0000 (UTC) From: "Antanas Ursulis" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Antanas Ursulis" Message-ID: <1372807725.4b161bb193dd40a6be29082d26586655c02e1cc4.uranium@gentoo> Subject: [gentoo-commits] proj/log-analysis:master commit in: / X-VCS-Repository: proj/log-analysis X-VCS-Files: simple_client.py X-VCS-Directories: / X-VCS-Committer: uranium X-VCS-Committer-Name: Antanas Ursulis X-VCS-Revision: 4b161bb193dd40a6be29082d26586655c02e1cc4 X-VCS-Branch: master Date: Wed, 3 Jul 2013 07:15:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 902aee52-2c27-44ba-89b9-759afc4b22ec X-Archives-Hash: a8dd9ad51c9a7779cb68b5bec8515c09 commit: 4b161bb193dd40a6be29082d26586655c02e1cc4 Author: Antanas Uršulis gmail com> AuthorDate: Tue Jul 2 23:28:45 2013 +0000 Commit: Antanas Ursulis gmail com> CommitDate: Tue Jul 2 23:28:45 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/log-analysis.git;a=commit;h=4b161bb1 Simple file submission client, based on urllib and protobuf --- simple_client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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])