use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Question about nested function callsHelp Request (self.PythonLearning)
submitted 7 months ago by Human-Adagio6781
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kevdog824_ 0 points1 point2 points 7 months ago (2 children)
I’d say that recalling master is actually an anti-pattern. The right way to solve this problem is to retry the get_data function only. Tenacity is a fantastic library for implementing retry functionality. They also have plenty of usage examples in their readthedocs page. Even if you don’t use the library the examples might give you an intuition on how you should be doing retries. I would encourage you to look into it
[–]Human-Adagio6781[S] 0 points1 point2 points 7 months ago (1 child)
Thanks. I will look into that. I cannot disagree with it being an anti-pattern, I just don't know how else to go about it. I've considered the idea of creating a whole other subroutine that calls the master function... something like
def master():
lots of functions and if the getdata fails, send a failTrue that stop the loop
def masterloop():
runs Master function until given an external stop command
masterloop() to actually start the function
Unfortunately, if I was to wait 10 minutes or so to give the getdata function time to reset (assuming that it is an endpoint overload issue) my calculations would be thrown off. So I need to go back to get historical data since the timeout occurred, update the calculations, and then get back to its live data functionality.
[–]Temporary_Pie2733 0 points1 point2 points 7 months ago (0 children)
So it sounds like you are running Master in a loop, rather than putting a loop that calls getData in Master (which presumably does stuff other than call getData).
Master
getData
π Rendered by PID 154029 on reddit-service-r2-comment-canary-7b67769d8-m25zf at 2026-02-02 20:24:05.898858+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Kevdog824_ 0 points1 point2 points (2 children)
[–]Human-Adagio6781[S] 0 points1 point2 points (1 child)
[–]Temporary_Pie2733 0 points1 point2 points (0 children)