db0 / pythorhead

A python library for interacting with Lemmy
GNU Affero General Public License v3.0
77 stars 25 forks source link

Timeout when uploading images #95

Open Krafting opened 4 months ago

Krafting commented 4 months ago

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.

db0 commented 4 months ago

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.

Krafting commented 4 months ago

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!