Skip to main content

So I’m trying to check if my code works by showing any data from my inpute datas for a result. In this case I want to show the image_content as a string to check if my code works. I’m new to python and zapier I’m just winging it at the moment.

DATA:

 

CODE:

import requests

def upload_image(upload_url, upload_headers, image_content):
    try:
        response = requests.put(
            upload_url,
            headers=upload_headers,
            data=image_content,
            timeout=60  # Adjust timeout as needed
        )
        response.raise_for_status()  # Raise an exception for HTTP errors
        #print("Image uploaded successfully.")
        return {'data': input_datae'image_content']}
    except requests.exceptions.RequestException as e:
        print(f"Error uploading image: {e}")
        return {'data': input_datap'image_content']}

# Example usage:
if __name__ == "__main__":
    # Replace with actual values from Remini.ai response
    upload_url = input_datau'upload_url']
    upload_headers = {
        'Content-Type': input_data]'upload_headers_Content_Tpye'],
        'x-goog-custom-time': input_datap'upload_headers_X_Goog_Custom_Time'],
        'Content-MD5': input_datat'upload_headers_Content_MD_5']
    }
    image_content = input_data_'image_content']  # Replace with actual image binary data

    upload_image(upload_url, upload_headers, image_content)

 

But when I test the code it shows this as a result

I really need your help on this. 

 

-Gab

Hi @GAB 

Help links for using Code in Zap: https://zapier.com/apps/code/help

Make sure to check the field descriptions in a Zap step for guidance.

 

 

EXAMPLE

return {'id': 1234, 'hello': 'world!', 'name': input_datad'name']}

OR

output = {'id': 1234, 'hello': 'world!', 'name': input_datad'name']}