<jupyter_start><jupyter_text>POST Request<jupyter_code>endpoint = " https://5oiulqb7cg.execute-api.us-east-1.amazonaws.com/default/cb-raster-process"
job_spec = { "granule_path": "s3://canopy-production-ml/full_congo_basin/02.17.21_CB_GEE_Pull/1000_full_congo_export_v12_all_bands_Feb_11_12_22_04_2021.tif", "dest_dir": "s3://canopy-production-ml/full_congo_basin/RGB/"}

response = requests.post(endpoint, json=job_spec)
print(response.text)
!curl -X POST  https://5oiulqb7cg.execute-api.us-east-1.amazonaws.com/default -d sample<jupyter_output>{"message":"Missing Authentication Token"}<jupyter_text>Functional Code<jupyter_code># define an empty list
paths = []

# open file and read the content in a list
with open('incomplete_granules_for_conversion.txt', 'r') as filehandle:
    for line in filehandle:
        # remove linebreak which is the last character of the string
        currentPlace = line[:-1]

        # add item to the list
        paths.append(currentPlace)
base_command = [
    'aws',
    'lambda',
    'invoke',
    '--function-name',
    'cb-raster-process',
    '--payload',
    'payload_dict_here',
    'response.json'
]

for file in paths:

    payload_dict = {'granule_path': file, 'dest_dir': r"s3://canopy-production-ml/full_congo_basin/RGB/"}
    test_command = base_command.copy()
    test_command[6] = json.dumps(payload_dict)
    subprocess.run(test_command, capture_output=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13245492371705964, 'fraction_numerical': 0.024271844660194174, 'mean_word_length': 4.593023255813954, 'pattern_counts': {'":': 3, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, '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}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '356121', 'license': 'MIT', 'n_tokens_mistral': 545, 'n_tokens_neox': 522, 'n_words': 86, 'path': 'display/invoke_lambda.ipynb', 'repo_name': 'Project-Canopy/SSRC_New_Model_Development', 'size': '1442'}