Taran Singh
06/14/2023, 6:00 PMNate
06/14/2023, 6:21 PMpip install -U prefect
from prefect import flow, task
from typing import List
import httpx
@task(retries=3)
def get_stars(repo: str):
url = f"<https://api.github.com/repos/{repo}>"
count = httpx.get(url).json()["stargazers_count"]
print(f"{repo} has {count} stars!")
@flow(name="GitHub Stars")
def github_stars(repos: List[str]):
for repo in repos:
get_stars(repo)
# run the flow!
github_stars(["PrefectHQ/Prefect"])
and then check out Prefect Cloud for free to see how you can track your workflows from there, using the concept of deployments, blocks and automations!
let us know if you run into any trouble!