Got the database setup and am able to pull a random word from the query. I can read the themes table and have the async functions setup, but not yet working as expected. There are a few test scripts in there that need to be cleaned up before pushing to main.

This commit is contained in:
Norm Rasmussen
2023-12-04 13:42:06 -05:00
parent df49bc9b26
commit e1c61bec3d
13 changed files with 178276 additions and 14 deletions

26
async_test.py Normal file
View File

@ -0,0 +1,26 @@
import asyncio
import requests
async def grab_words():
while True:
await asyncio.sleep(.5)
word = str(requests.get("https://random-word-api.herokuapp.com/word").text)[2:-2]
print(word)
async def every(__seconds: float, func, *args, **kwargs):
while True:
func(*args, **kwargs)
await asyncio.sleep(__seconds)
async def main():
asyncio.ensure_future(grab_words())
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(grab_words())
loop.run_forever()
# loop.create_task(every(1, grab_words()))