This is part of a script that iterates over our current ecommerce products and then checks stock at the distributor. This code is in a for loop, which is why the end of the except statement has "continue". I'm getting the following error intermittently:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I thought I would be able to catch the error and continue the for loop. What am I doing wrong? I was under the impression that except requests.exceptions.RequestException as _error:
would catch all errors.
Here is the code:
try:
print("Line 85")
Check_BC_API_CALLS()
print("Line 87")
r2 = requests.get('https://api.bigcommerce.com/stores/' + _BcStoreHash + '/v3/catalog/products?page=' + str(_CurrentPage) + '&limit=1', headers=_BcHeaders)
print("Line 90")
except requests.exceptions.RequestException as _error:
print("BigCommerce request failed: " + _error)
Check_BC_API_CALLS()
continue
