Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Await upload_media with AsyncWhatsApp throws error #59

Closed
nutax opened this issue Nov 24, 2024 · 2 comments
Closed

[BUG] Await upload_media with AsyncWhatsApp throws error #59

nutax opened this issue Nov 24, 2024 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@nutax
Copy link

nutax commented Nov 24, 2024

document = await app.upload_media(f"./sample.pdf")

ERROR: Only io.IOBase, multidict and (name, file) pairs allowed, use .add_field() for passing more complex parameters, got <MultipartEncoder: {'file': ('./sample.pdf', <_io.BufferedReader name='/sample.pdf'>, 'application/pdf'), 'messaging_product': 'whatsapp', 'type': 'application/pdf'}>

@nutax nutax changed the title [BUG] Await upload file with AsyncWhatsApp throws error [BUG] Await upload_file with AsyncWhatsApp throws error Nov 24, 2024
@nutax nutax changed the title [BUG] Await upload_file with AsyncWhatsApp throws error [BUG] Await upload_media with AsyncWhatsApp throws error Nov 24, 2024
@filipporomani filipporomani self-assigned this Nov 25, 2024
@filipporomani filipporomani added bug Something isn't working good first issue Good for newcomers labels Nov 25, 2024
@filipporomani
Copy link
Owner

Working on this!

@filipporomani
Copy link
Owner

As I found no actual way to fix this issue - the aiohttp multiwriter is just crap for this kind of stuff - I decided to keep this function syncronous and so also blocking.
Reading the files in a non-blocking way is also way complex to implement, so the function would be blocking anyways.

I'll see if I'm able to find a solution in the future, but for now I'm gonna push a fix commit for this issue that basically makes the function blocking (you still need to await it tho).

Thank you for reporting the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants