pythorhead icon indicating copy to clipboard operation
pythorhead copied to clipboard

Timeout when uploading images

Open Krafting opened this issue 1 year ago • 2 comments

Sometimes, I get a timeout when uploading images using Pythorhead:

HTTPSConnectionPool(host='lemmy.world', port=443): Read timed out. (read timeout=3)

The timeout should be higher by default when uploading an image, as servers can sometime take a while to process high quality images (such as 4K and above), or even when you are using a slower Internet connection.

Or is there a way to select the timeout manually somehow ? I didn't see anything about that in the code.

Krafting avatar May 02 '24 23:05 Krafting

There's a way to set the timeout for all operations when creating the lemmy instance, but I'll see if I can make the timeout different for images.

db0 avatar May 03 '24 07:05 db0

Oh, yeah I didn't see you could add the Timeout to Lemmy() :

lemmy = Lemmy(config['url'], request_timeout=15)

I did this and it seems to work fine now for my usecase.

Thanks for your answer!

But if posting images could be higher by default, it would still be a good idea imo!

Krafting avatar May 03 '24 09:05 Krafting