<s> import sys <EOL> import os <EOL> import json <EOL> sys . path . append ( os . path . dirname ( os . path . dirname ( __file__ ) ) ) <EOL> import asana <EOL> from six import print_ <EOL> def user_select_option ( message , options ) : <EOL> option_lst = list ( options ) <EOL> print_ ( message ) <EOL> for i , val in enumerate ( option_lst ) : <EOL> print_ ( i , '<STR_LIT>' + val [ '<STR_LIT:name>' ] ) <EOL> index = int ( input ( "<STR_LIT>" ) or <NUM_LIT:0> ) <EOL> return option_lst [ index ] <EOL> if '<STR_LIT>' in os . environ : <EOL> client = asana . Client . access_token ( os . environ [ '<STR_LIT>' ] ) <EOL> workspaces = client . workspaces . find_all ( ) <EOL> workspace = user_select_option ( "<STR_LIT>" , workspaces ) <EOL> projects = client . projects . find_all ( { '<STR_LIT>' : workspace [ '<STR_LIT:id>' ] } ) <EOL> project = user_select_option ( "<STR_LIT>" , projects ) <EOL> result = client . tasks . create_in_workspace ( workspace [ '<STR_LIT:id>' ] , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ project [ '<STR_LIT:id>' ] ] } ) <EOL> print_ ( json . dumps ( result , indent = <NUM_LIT:4> ) ) </s>
