<s> """<STR_LIT>""" <EOL> __author__ = "<STR_LIT>" <EOL> import datetime <EOL> import json <EOL> import time <EOL> import urllib <EOL> import urllib2 <EOL> import argparse <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , help = "<STR_LIT>" , action = "<STR_LIT:store>" , <EOL> default = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , help = "<STR_LIT>" , action = "<STR_LIT:store>" , <EOL> default = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , help = "<STR_LIT>" , action = "<STR_LIT:store>" , <EOL> default = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , help = "<STR_LIT>" , action = "<STR_LIT:store>" , <EOL> default = "<STR_LIT>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> args = parser . parse_args ( ) <EOL> while True : <EOL> data = { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> } <EOL> totals = [ ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> for name , clients , bitrate , streambitrate in totals : <EOL> fixed_name = name . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT:->' , '<STR_LIT:_>' ) <EOL> data [ fixed_name + "<STR_LIT>" ] = int ( clients ) <EOL> data [ fixed_name + "<STR_LIT>" ] = float ( bitrate ) <EOL> data [ fixed_name + "<STR_LIT>" ] = float ( bitrate ) <EOL> data [ "<STR_LIT>" ] += clients <EOL> data [ "<STR_LIT>" ] += bitrate <EOL> data [ "<STR_LIT>" ] += clients * streambitrate <EOL> for group in args . group . split ( '<STR_LIT:U+002C>' ) : <EOL> try : <EOL> req = urllib2 . Request ( <EOL> args . server , <EOL> urllib . urlencode ( ( <EOL> ( '<STR_LIT>' , args . secret ) , <EOL> ( '<STR_LIT>' , group ) , <EOL> ( '<STR_LIT:data>' , json . dumps ( data ) ) , <EOL> ( '<STR_LIT>' , args . ip ) , <EOL> ) ) ) <EOL> r = urllib2 . urlopen ( req ) <EOL> except urllib2 . HTTPError , e : <EOL> print e <EOL> print e . read ( ) <EOL> raise <EOL> print "<STR_LIT>" , group , "<STR_LIT>" , datetime . datetime . now ( ) , "<STR_LIT:result>" , r . read ( ) . strip ( ) <EOL> time . sleep ( <NUM_LIT:1> ) </s>
