Aug-22-2021, 04:16 PM
Disclaimer - I am not a professional dev/engineer
Use case = check if X happens Y amt of times, do something/alert
For the sake of this post, let's saying X = user tweet a certain #X can really be anything, so let's not focus on TWTR API/limits/security. For example, X can be when CNN posts certain keyword article or user posts a new tiktok, it doesn't matter in this post.
My guess for requirements is...HW - need some box running 24/7, like an AWS ec2 boxDB - I assume you need a DB to store checks (the Y amt of times)
My pseudo code is
Use case = check if X happens Y amt of times, do something/alert
For the sake of this post, let's saying X = user tweet a certain #X can really be anything, so let's not focus on TWTR API/limits/security. For example, X can be when CNN posts certain keyword article or user posts a new tiktok, it doesn't matter in this post.
My guess for requirements is...HW - need some box running 24/7, like an AWS ec2 boxDB - I assume you need a DB to store checks (the Y amt of times)
My pseudo code is
def checker(): # check if user tweets def addtodb(): # store the check so we can count, basically a ++ def checkdb(): # query db to check when count is 3 def endaction(): # alert me if (checker() == true): addtodb() if (checkdb == 3): endaction()Am I going about this correctly? Some initial questions that come to mind is how to I endlessly run a check? I don't think it makes sense to run this code (.py file) every 1 second in an infinite loop via cron. Maybe can leverage streaming/kafka? Any particular examples, libraries, of packages you would recommend?