alpacahq / pipeline-live

Pipeline Extension for Live Trading
https://pypi.org/project/pipeline-live/
Apache License 2.0
204 stars 56 forks source link

Retry in the case of temporary API error #1

Open umitanuki opened 6 years ago

umitanuki commented 6 years ago

Sometimes, we see this kind of temporary issue in API and it's better to be able to retry so the entire script doesn't stop.

File "c:\users\john\anaconda3\lib\site-packages\requests\adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.iextrading.com', port=443): Max retries exceeded with url: /1.0/stock/market/batch?symbols=STNE%2CSTNG%2CSTNL%2CSTNLU%2CSTNLW%2CSTON%2CSTOR%2CSTOT%2CSTPP%2CSTPZ%2CSTRA%2CSTRL%2CSTRM%2CSTRO%2CSTRS%2CSTRT%2CSTT%2CSTT-C%2CSTT-D%2CSTT-E%2CSTT-G%2CSTWD%2CSTX%2CSTXB%2CSTZ%2CSTZ.B%2CSU%2CSUB%2CSUI%2CSUM%2CSUMR%2CSUN%2CSUNS%2CSUNW%2CSUP%2CSUPN%2CSUPV%2CSURF%2CSUSA%2CSUSB%2CSUSC%2CSVA%2CSVBI%2CSVM%2CSVMK%2CSVRA%2CSVT%2CSVVC%2CSVXY%2CSWAN%2CSWCH%2CSWI%2CSWIR%2CSWJ%2CSWK%2CSWKS%2CSWM%2CSWN%2CSWP%2CSWX%2CSWZ%2CSXC%2CSXCP%2CSXE%2CSXI%2CSXT%2CSYBT%2CSYBX%2CSYE%2CSYF%2CSYG%2CSYK%2CSYKE%2CSYLD%2CSYMC%2CSYN%2CSYNA%2CSYNC%2CSYNH%2CSYNL%2CSYPR%2CSYRS%2CSYV%2CSYX%2CSYY%2CSZC%2CSZK%2CSZNE%2CSZO%2CT%2CTA%2CTAC%2CTACO%2CTACOW%2CTACT%2CTAGS%2CTAHO%2CTAIL%2CTAIT&types=chart&range=2y (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000002503D0E0390>: Failed to establish a new connection: [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',))