[Python] PiXhost's API- upload images

Discussão em 'Python' iniciado por Stack, Junho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use PiXhost's api to upload images. Every time I request something from https://api.pixhost.to/images it always returns 400 Bad request. Their API documentation uses python unirest package, but I can't install it as it seems to use too old code.

    Am I doing something wrong here?

    Link to documentation

    my code:

    import requests
    headers = {
    "Content-Type": "multipart/form-data; charset=utf-8",
    "Accept": "application/json"
    }
    params = {
    "content_type": "0",
    "max_th_size": "420"
    }
    files = {
    "img": open("image.jpg", mode="rb")
    }

    response = requests.post("https://api.pixhost.to/images", headers=headers, params=params, files=files)```

    Continue reading...

Compartilhe esta Página