Auto-update: Mon Sep 2 14:41:54 PDT 2024
This commit is contained in:
parent
024de4615b
commit
5b85b17f11
1 changed files with 24 additions and 0 deletions
24
sijapi/helpers/article.py
Executable file
24
sijapi/helpers/article.py
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/Users/sij/miniforge3/envs/sijapi/bin/python
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
from fastapi import BackgroundTasks
|
||||
from sijapi.routers.news import process_and_save_article
|
||||
|
||||
async def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <article_url>")
|
||||
sys.exit(1)
|
||||
|
||||
url = sys.argv[1]
|
||||
bg_tasks = BackgroundTasks()
|
||||
|
||||
try:
|
||||
result = await process_and_save_article(bg_tasks, url)
|
||||
print(result)
|
||||
except Exception as e:
|
||||
print(f"Error processing article: {str(e)}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
Loading…
Add table
Reference in a new issue