How Can I Increase the Timeout When Batch-Updating Products Using WooCommerce API in a Python Task?

This topic was automatically generated from Slack. You can find the original thread here.

Hi everyone. I’m trying to batch-update products using the WooCommerce API in a Python task. Unfortunately, I’m always running into a timeout. Sometimes sooner, sometimes later.

HTTPSConnectionPool(host='[www.kaybeekids.ch](http://www.kaybeekids.ch)', port=443): Read timed out. (read timeout=5)

Is there a way to increase the timeout? I try to cool off the script using some time.sleep() before the requests to the server but no luck.

I also tried to increase the socket timeout for PHP on the server side but as this has no effect, I don’t think this is related.

Does maybe someone has some other ideas? The site is running behind Cloudflare Enterprise. I think this could be an issue too. I’m also going to talk to them too.

The client can also close the connection if it hasn’t received a response in a certain amount of time. Different HTTP libraries handle this differently, but try setting the timeout param in your code if possible, e.g. here’s how to set it on the requests lib: https://requests.readthedocs.io/en/latest/user/quickstart/#timeouts .

Do you have any other ideas for how to help?

Hi . Thank you very much for your reply and help. Interestingly, I wasn’t able to find a timeout option in the official documentation on woocommerce.com. But on pypi.org, there is one. That fixed the issue :+1::skin-tone-2:. Thank you very much