Skip to content

latin-1 codec error when uploading images to /p/{pack_id}/tunes via Python requests #142

Description

@Aleexandar

Hi Astria team 👋

First of all — thank you for your amazing product! It’s really impressive and exciting to work with 🙌

I’m currently building a Telegram bot (in Python) that connects to Astria via the official endpoint:
POST https://api.astria.ai/p/260/tunes

We’re uploading a set of user images to create a new tune, strictly following the documentation. However, we keep running into this server-side error:

Astria error: ‘latin-1’ codec can’t encode characters in position 10–13: ordinal not in range(256)

✅ We’ve double-checked everything:

  • Filenames are plain ASCII:new tune, stri
    Hi Astria tea etc.
  • No emojis or special characters inou for your amaori Astria team - Field names exactly match the docs:ank you for you
    Hi Astria tea
    Hi Astria team 👋- All images are sent ast of all via Astria team using standard 👋

First of all- Headers are standard

  • The server is hosted on Heroku, all encodings are set to UTF-8 (LANG,d exciting LC_CTYPE)

Here’s a simplified version of our code:

files = [
    ("tune[images][]", ("image0.jpg", image_bytes_0, "image/jpeg")),
    ("tune[images][]", ("image1.jpg", image_bytes_1, "image/jpeg")),
    # ...
]

It seems like the API server is trying to decode something as latin-1, even though both filenames and fields are clean ASCII.

❓ Is this a known issue?
Or could we be missing something obvious?

Happy to share logs, request headers or a minimal working example if that helps!

Thanks so much in advance 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions