Image Upload API giving dishonest errors

meatcomputermeatcomputer Member Posts: 23
Hello, I am in the midst of writing a program which interfaces with the lightspeed api.
Everything has been going smoothly so far until today when I tried to use the image uploading functionality of the API as described here https://developers.lightspeedhq.com/retail/endpoints/Image/
Upon trying to test the system using the provided python code I get errors saying that my image exceeds 8MB, the image I was testing with is less than 10kb so I'm clearly getting an erroneous error message.
Here is my code

def upload_image_to_lightspeed():
    files = {'image': ('testimage.jpg', open("/home/meatcomputer/Desktop/avatar.jpg", "rb")
        , 'image/jpeg')}
    payload = {
        "description": "Test Image",
        "ordering": 1,
        "itemID":222
        }

    r = requests.post(url, files=files, data=payload, headers=headers)
    return r



Why am I getting this error message and what can I do to address

4 comments

Sign In or Register to comment.