You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes when downloading a lot of data from NasdaqDataLink, I get a hung connection during the ssl handshake. The requests library, which is being used to make requests, can take a timeout parameter, but this is not exposed through the API as far as I can tell.
What's the best way to retry after a timeout?
I noticed that the ApiConfig and Connection have retry parameters, but it still appears to be hanging.
-- Please reply above this line --
Dear Nasdaq/data-Link-Python,
Thank you for contacting the Nasdaq Data Client Success Team. Your
email is very important to us and we will respond to you within 1 to 2
business days.
To efficiently support your request, please include relevant details
such as the data product/feed you are inquiring about.
Kind regards,
Nasdaq Data Client Success
[1]
Links:
------
[1] https://www.nasdaq.com/
WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.
Sometimes when downloading a lot of data from NasdaqDataLink, I get a
hung connection during the ssl handshake. The requests library, which
is being used to make requests, can take a timeout parameter, but this
is not exposed through the API as far as I can tell.
What's the best way to retry after a timeout?
-
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you are subscribed to this
thread.Message ID:
***@***.***>
Links:
------
[1] #39
[2]
https://github.com/notifications/unsubscribe-auth/AWYQ644AWJSEYMALXQGWKI3X2H7QVANCNFSM6AAAAAA4W5LXP4
Hello,
Thank you for contacting us.
We are looking into your request and will get back to you soon.
Thanks,
VAIBHAV TEMBEY
Nasdaq Data Client Success
> On Wed, Sep 13, 2023 at 3:04 PM EDT, Nasdaq/data-Link-Python ***@***.***> wrote:
>
> WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.
>
> Sometimes when downloading a lot of data from NasdaqDataLink, I get a
> hung connection during the ssl handshake. The requests library, which
> is being used to make requests, can take a timeout parameter, but this
> is not exposed through the API as far as I can tell.
>
> What's the best way to retry after a timeout?
>
> -
> Reply to this email directly, view it on GitHub [1], or unsubscribe
> [2].
> You are receiving this because you are subscribed to this
> thread.Message ID:
> ***@***.***>
>
> Links:
> ------
> [1] #39
> [2]
> https://github.com/notifications/unsubscribe-auth/AWYQ644AWJSEYMALXQGWKI3X2H7QVANCNFSM6AAAAAA4W5LXP4
>
>
>
>
The error is that sometimes the request simply does not complete. This is normal and expected some percentage of the time for networked applications.
I forked the library and added a timeout parameter. This allows me to do this is in my code:
def ndl_get_table_with_retry(table, **kwargs):
timeouts = [5, 10, 20, 40, 80]
last_error = None
for attempt, timeout in enumerate(timeouts):
try:
return ndl.get_table(table, timeout=timeout, **kwargs)
except Exception as e:
last_error = e
error_msg = str(e).lower()
# Don't retry on auth errors or invalid requests
if 'unauthorized' in error_msg or 'api key' in error_msg:
raise
if 'invalid' in error_msg and 'ticker' in error_msg:
raise
# Log retry attempt
if attempt < len(timeouts) - 1:
print(f" Nasdaq API timeout ({timeout}s), retrying with {timeouts[attempt + 1]}s timeout...")
time.sleep(1) # Brief pause before retry
# All retries exhausted
raise TimeoutError(
f"Nasdaq Data Link API failed after {len(timeouts)} attempts "
f"(timeouts: {timeouts}). Last error: {last_error}"
)
Activity
clientsuccessnasdaq commentedon Sep 13, 2023
clientsuccessnasdaq commentedon Sep 14, 2023
clientsuccessnasdaq commentedon Sep 18, 2023
christian-oudard commentedon Dec 15, 2025
The error is that sometimes the request simply does not complete. This is normal and expected some percentage of the time for networked applications.
I forked the library and added a timeout parameter. This allows me to do this is in my code: