<commit_before>#!/bin/python

import sys
import urllib2

def main():

    try:
        sys.path.append("/Users/johndingee_seed/Desktop/")
        import odk_settings as odk_settings
    except ImportError:
        sys.path.append("/home/ubuntu/ODK/")
        import odk_settings

    REGION_FORM="VCM_Sett_Coordinates_1.2"
    # UUID=$(uuidgen)

    base_url_string = '%s?username=%s&api_key=%s' % (odk_settings.API_ROOT, \
        odk_settings.POLIO_USERNAME, odk_settings.POLIO_KEY)

    start_odk_jar_url_string = base_url_string + '&task=start_odk_jar'

    response = urllib2.urlopen(start_odk_jar_url_string, data=None)
    print response.read()#data

    # "${API_ROOT}?task=start_odk_jar&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"


    # wget -O/dev/null "${API_ROOT}?task=start_odk_jar&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"
    #
    # for FORM in "${FORMS[@]}";
    #  do
    #    echo $FORM
    #     java -jar $JAR_FILE \
    #      --form_id $FORM \
    #      --export_filename $FORM \
    #      --aggregate_url $AGGREGATE_URL \
    #      --storage_directory $STORAGE_DIRECTORY \
    #      --export_directory $EXPORT_DIRECTORY \
    #      --odk_username $ODK_USER admin \
    #      --odk_password $ODK_PASS <PASSWORD> \
    #      --exclude_media_export;
    # done
    #
    # sleep 2
    # # DONE WITH ODK JAR FILE #
    # wget -O/dev/null "${API_ROOT}?task=finish_odk_jar&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"
    #
    # sleep 2
    #
    # # DONE WITH ODK JAR FILE #
    # wget -O/dev/null "${API_ROOT}?task=ingest_odk_regions&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"


if __name__ == "__main__":
  main()<commit_msg>use subprocess to call odk jar file in refresh_odk.py<commit_after>#!/bin/python

import sys
import urllib2
import subprocess

def main():

    try:
        sys.path.append("/Users/johndingee_seed/Desktop/")
        import odk_settings as odk_settings
    except ImportError:
        sys.path.append("/home/ubuntu/ODK/")
        import odk_settings

    REGION_FORM="VCM_Sett_Coordinates_1.2"
    # UUID=$(uuidgen)

    base_url_string = '%s?username=%s&api_key=%s' % (odk_settings.API_ROOT, \
        odk_settings.POLIO_USERNAME, odk_settings.POLIO_KEY)

    start_odk_jar_url_string = base_url_string + '&task=start_odk_jar&form_name=' + REGION_FORM

    response = urllib2.urlopen(start_odk_jar_url_string, data=None)

    subprocess.call(['java','-jar',odk_settings.JAR_FILE,\
        '--form_id', REGION_FORM, \
        '--export_filename',REGION_FORM +'.csv', \
        '--aggregate_url',odk_settings.AGGREGATE_URL, \
        '--storage_directory',odk_settings.STORAGE_DIRECTORY, \
        '--export_directory',odk_settings.EXPORT_DIRECTORY, \
        '--odk_username',odk_settings.ODK_USER, \
        '--odk_password',odk_settings.ODK_PASS, \
        '--overwrite_csv_export' ,\
        '--exclude_media_export' \
      ])

    sleep(5)
    start_odk_jar_url_string = base_url_string + '&task=finish_odk_jar&form_name=' + REGION_FORM

    # # DONE WITH ODK JAR FILE #
    # wget -O/dev/null "${API_ROOT}?task=finish_odk_jar&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"
    #
    # sleep 2
    #
    # # DONE WITH ODK JAR FILE #
    # wget -O/dev/null "${API_ROOT}?task=ingest_odk_regions&username=${POLIO_USERNAME}&api_key=${POLIO_KEY}&cron_guid=${UUID}"


if __name__ == "__main__":
  main()
{'fraction_non_alphanumeric': 0.14232209737827714, 'fraction_numerical': 0.003457216940363008, 'mean_word_length': 3.34, 'pattern_counts': {'":': 2, '<': 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': '4415832', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1303, 'n_words': 169}