<commit_before>import json
import os
import sys
import requests

def upload_test_results():
    APEXTESTSDB_BASE_URL=os.environ.get('APEXTESTSDB_BASE_URL')
    APEXTESTSDB_USER_ID=os.environ.get('APEXTESTSDB_USER_ID')
    APEXTESTSDB_TOKEN=os.environ.get('APEXTESTSDB_TOKEN')

    PACKAGE=os.environ.get('PACKAGE')
    REPOSITORY_URL=os.environ.get('REPOSITORY_URL')
    BRANCH_NAME=os.environ.get('BRANCH_NAME')
    COMMIT_SHA=os.environ.get('COMMIT_SHA')
    EXECUTION_NAME=os.environ.get('EXECUTION_NAME')
    EXECUTION_URL=os.environ.get('EXECUTION_URL')
    RESULTS_FILE_PATH=os.environ.get('RESULTS_FILE_PATH')

    payload = {
        'package': PACKAGE,
        'repository_url': REPOSITORY_URL,
        'branch_name': BRANCH_NAME,
        'commit_sha': COMMIT_SHA,
        'execution_name': EXECUTION_NAME,
        'execution_url': EXECUTION_URL,
        'user': APEXTESTSDB_USER_ID,
        'token': APEXTESTSDB_TOKEN,
    }

    files = {
        'results_file': open(RESULTS_FILE_PATH, 'rb'),
    }

    response = requests.post(APEXTESTSDB_BASE_URL + '/upload_test_result', files=files, data=payload)
    data = json.loads(response.content)
    return '%s/executions/%s' % (APEXTESTSDB_BASE_URL, data['execution_id'])

if __name__ == '__main__':
    try:
        execution_detail_url = upload_test_results()
        print execution_detail_url
    except:
        import traceback
        exc_type, exc_value, exc_traceback = sys.exc_info()<commit_msg>Add environment to upload client<commit_after>import json
import os
import sys
import requests

def upload_test_results():
    APEXTESTSDB_BASE_URL=os.environ.get('APEXTESTSDB_BASE_URL')
    APEXTESTSDB_USER_ID=os.environ.get('APEXTESTSDB_USER_ID')
    APEXTESTSDB_TOKEN=os.environ.get('APEXTESTSDB_TOKEN')

    PACKAGE=os.environ.get('PACKAGE')
    REPOSITORY_URL=os.environ.get('REPOSITORY_URL')
    BRANCH_NAME=os.environ.get('BRANCH_NAME')
    COMMIT_SHA=os.environ.get('COMMIT_SHA')
    EXECUTION_NAME=os.environ.get('EXECUTION_NAME')
    EXECUTION_URL=os.environ.get('EXECUTION_URL')
    RESULTS_FILE_PATH=os.environ.get('RESULTS_FILE_PATH')
    ENVIRONMENT_NAME=os.environ.get('ENVIRONMENT_NAME')

    payload = {
        'package': PACKAGE,
        'repository_url': REPOSITORY_URL,
        'branch_name': BRANCH_NAME,
        'commit_sha': COMMIT_SHA,
        'execution_name': EXECUTION_NAME,
        'execution_url': EXECUTION_URL,
        'environment_name': ENVIRONMENT_URL,
        'user': APEXTESTSDB_USER_ID,
        'token': <PASSWORD>,
    }

    files = {
        'results_file': open(RESULTS_FILE_PATH, 'rb'),
    }

    response = requests.post(APEXTESTSDB_BASE_URL + '/upload_test_result', files=files, data=payload)
    data = json.loads(response.content)
    return '%s/executions/%s' % (APEXTESTSDB_BASE_URL, data['execution_id'])

if __name__ == '__main__':
    try:
        execution_detail_url = upload_test_results()
        print execution_detail_url
    except:
        import traceback
        exc_type, exc_value, exc_traceback = sys.exc_info()
{'fraction_non_alphanumeric': 0.1160802367642223, 'fraction_numerical': 0.0, 'mean_word_length': 4.01980198019802, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5184234', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1104, 'n_words': 140}