Allow configuring timeout for WooCommerce API

at least when importing data from Woo
This commit is contained in:
Lance Edgar 2022-10-19 09:51:51 -05:00
parent f650ad4802
commit ddced3e90c

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2021 Lance Edgar # Copyright © 2010-2022 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -61,6 +61,11 @@ class FromWooCommerce(importing.Importer):
'consumer_secret': self.config.require('woocommerce', 'api_consumer_secret'), 'consumer_secret': self.config.require('woocommerce', 'api_consumer_secret'),
'version': 'wc/v3', 'version': 'wc/v3',
} }
timeout = self.config.getint('woocommerce', 'api_timeout')
if timeout:
kwargs['timeout'] = timeout
self.api = WooAPI(**kwargs) self.api = WooAPI(**kwargs)
def get_woocommerce_products(self): def get_woocommerce_products(self):