'Bigcommerce API connection disconnects with no response
We've been using a Python script to pull orders from our BigCommerce store and reformat them into a .csv for use by our warehouse. This method has been working for the past 3 years yet since the 16 September 2020 our connection has started dropping without a response.
Full response is:
Downloading Order: 1541
WPy64-3720\python-3.7.2.amd64\python.exe : Traceback (most recent call last):
At D:\Administration\Scripts\re_orders\reau-orders.ps1:7 char:28
+ $OrdersProcessingOutput = (WPy64-3720\python-3.7.2.amd64\python.exe bcOrdersREAU ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 1321, in
getresponse
response.begin()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 296, in begin
version, status, reason = self._read_status()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 265, in
_read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Administration\Scripts\re_orders\requests\adapters.py", line 438, in send
timeout=timeout
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\util\retry.py", line 357, in increment
raise six.reraise(type(error), error, _stacktrace)
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "D:\Administration\Scripts\re_orders\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 1321, in
getresponse
response.begin()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 296, in begin
version, status, reason = self._read_status()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\http\client.py", line 265, in
_read_status
raise RemoteDisconnected("Remote end closed connection without"
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed
connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bcOrdersREAU.py", line 1254, in <module>
checkPendingPayments(basePath + pendingPayFile)
File "bcOrdersREAU.py", line 915, in checkPendingPayments
getOrders(orderId,orderId)
File "bcOrdersREAU.py", line 249, in getOrders
orderJSON = getOrder(headers,orderNo)
File "D:\Administration\Scripts\re_orders\tenacity\__init__.py", line 333, in wrapped_f
return self(f, *args, **kw)
File "D:\Administration\Scripts\re_orders\tenacity\__init__.py", line 417, in __call__
do = self.iter(retry_state=retry_state)
File "D:\Administration\Scripts\re_orders\tenacity\__init__.py", line 360, in iter
return fut.result()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\concurrent\futures\_base.py", line 425,
in result
return self.__get_result()
File "D:\Administration\Scripts\re_orders\WPy64-3720\python-3.7.2.amd64\lib\concurrent\futures\_base.py", line 384,
in __get_result
raise self._exception
File "D:\Administration\Scripts\re_orders\tenacity\__init__.py", line 420, in __call__
result = fn(*args, **kwargs)
File "bc
OrdersREAU.py", line 1155, in getOrder
order = session.get(ApiPath2 + 'orders/' + str(orderNo), headers=headers)
File "D:\Administration\Scripts\re_orders\requests\sessions.py", line 531, in get
return self.request('GET', url, **kwargs)
File "D:\Administration\Scripts\re_orders\requests\sessions.py", line 518, in request
resp = self.send(prep, **send_kwargs)
File "D:\Administration\Scripts\re_orders\requests\sessions.py", line 639, in send
r = adapter.send(request, **kwargs)
File "D:\Administration\Scripts\re_orders\requests\adapters.py", line 488, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without
response'))
The code we're using runs daily and is essentially just iterating through new orders and pulling the details down, including the ordered products. Something like:
requests.get(ApiPath2 + 'orders/' + str(orderNo), headers=headers) session.get(ApiPath2 + 'orders/' + str(orderNo) + '/products?page=' + str(page), headers=headers)
It doesn't fail every day but has started to be almost a daily occurrence now.
What we have tried:
- new API credentials
- different servers on a different network (Aus + Europe)
- Running the script at different times
Any help would be greatly appreciated. Currently we just keep re running the code manually until it works.
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nicki D |