""" Created by Koen van de Sande for the VideOlympics showcase http://www.videolympics.org Version: May 2008 """ import httplib import sys HOST = 'localhost' # The server PORT = 8001 # The port on the server to connect to TEAM = None # Team number if len(sys.argv) > 1: shotname = sys.argv[1] # Shot to submit team = sys.argv[2] # Team number (integer 1..n) else: raise Exception("You must specify a shotname and team number as a command-line argument") conn = httplib.HTTPConnection(HOST, port=PORT) req = """/team=%d/%s""" % (TEAM, shotname) conn.request("GET", req) resp = conn.getresponse() data = resp.read() conn.close() # returns one of the following: # OK\n # ERROR INVALID\n # ERROR TOOSOON\n # ERROR TOOLATE\n # please note that there is a newline at the end of the response data! print data,