<s> import json <EOL> import os <EOL> import sys <EOL> import requests <EOL> def upload_test_results ( ) : <EOL> APEXTESTSDB_BASE_URL = os . environ . get ( '<STR_LIT>' ) <EOL> APEXTESTSDB_USER_ID = os . environ . get ( '<STR_LIT>' ) <EOL> APEXTESTSDB_TOKEN = os . environ . get ( '<STR_LIT>' ) <EOL> PACKAGE = os . environ . get ( '<STR_LIT>' ) <EOL> REPOSITORY_URL = os . environ . get ( '<STR_LIT>' ) <EOL> BRANCH_NAME = os . environ . get ( '<STR_LIT>' ) <EOL> COMMIT_SHA = os . environ . get ( '<STR_LIT>' ) <EOL> EXECUTION_NAME = os . environ . get ( '<STR_LIT>' ) <EOL> EXECUTION_URL = os . environ . get ( '<STR_LIT>' ) <EOL> RESULTS_FILE_URL = os . environ . get ( '<STR_LIT>' ) <EOL> ENVIRONMENT_NAME = os . environ . get ( '<STR_LIT>' ) <EOL> payload = { <EOL> '<STR_LIT>' : PACKAGE , <EOL> '<STR_LIT>' : REPOSITORY_URL , <EOL> '<STR_LIT>' : BRANCH_NAME , <EOL> '<STR_LIT>' : COMMIT_SHA , <EOL> '<STR_LIT>' : EXECUTION_NAME , <EOL> '<STR_LIT>' : EXECUTION_URL , <EOL> '<STR_LIT>' : ENVIRONMENT_NAME , <EOL> '<STR_LIT:user>' : APEXTESTSDB_USER_ID , <EOL> '<STR_LIT>' : APEXTESTSDB_TOKEN , <EOL> '<STR_LIT>' : RESULTS_FILE_URL , <EOL> } <EOL> response = requests . post ( APEXTESTSDB_BASE_URL + '<STR_LIT>' , data = payload ) <EOL> data = json . loads ( response . content ) <EOL> return '<STR_LIT>' % ( APEXTESTSDB_BASE_URL , data [ '<STR_LIT>' ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> try : <EOL> execution_detail_url = upload_test_results ( ) <EOL> print execution_detail_url <EOL> except : <EOL> import traceback <EOL> exc_type , exc_value , exc_traceback = sys . exc_info ( ) <EOL> print '<STR_LIT:->' * <NUM_LIT> <EOL> traceback . print_exception ( exc_type , exc_value , exc_traceback , file = sys . stdout ) <EOL> print '<STR_LIT:->' * <NUM_LIT> <EOL> sys . exit ( <NUM_LIT:1> ) </s>
