<s> """<STR_LIT>""" <EOL> import urllib <EOL> from tornado . escape import utf8 <EOL> from tornado import gen <EOL> from tornado . httpclient import AsyncHTTPClient <EOL> from tornado . ioloop import IOLoop <EOL> from tornado . options import define , options , parse_command_line <EOL> import parse_cases <EOL> define ( '<STR_LIT:filename>' , default = '<STR_LIT>' ) <EOL> define ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> define ( '<STR_LIT:username>' , default = '<STR_LIT>' ) <EOL> define ( '<STR_LIT:password>' , default = '<STR_LIT>' ) <EOL> @ gen . coroutine <EOL> def main ( ) : <EOL> parse_command_line ( ) <EOL> assert options . password <EOL> client = AsyncHTTPClient ( ) <EOL> cases = parse_cases . parse_cases ( options . filename ) <EOL> url = '<STR_LIT>' % options . repo <EOL> for subject , assigned_to , body in cases : <EOL> args = { '<STR_LIT:title>' : utf8 ( subject ) , '<STR_LIT:content>' : utf8 ( body ) } <EOL> if assigned_to : <EOL> args [ '<STR_LIT>' ] = assigned_to <EOL> response = yield client . fetch ( url , method = '<STR_LIT:POST>' , body = urllib . urlencode ( args ) , <EOL> auth_username = options . username , auth_password = options . password ) <EOL> print response , response . body <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> IOLoop . instance ( ) . run_sync ( main ) </s>
