Adam Brusselback
09/02/2022, 2:50 PMimport httpx
from prefect import flow, task
@task(retries=3)
def get_stars(repo):
url = f"<https://api.github.com/repos/{repo}>"
count = httpx.get(url).json()["stargazers_count"]
print(f"{repo} has {count} stars!")
@flow()
def github_stars(repos):
for repo in repos:
get_stars.submit(repo)
# call the flow!
if __name__ == "__main__":
github_stars(["PrefectHQ/Prefect", "PrefectHQ/prefect-aws", "PrefectHQ/prefect-dbt"])
Jenny
09/02/2022, 7:31 PMAdam Brusselback
09/02/2022, 8:08 PMimport httpx
from prefect import flow, task
@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()
def github_stars(repos: list):
for repo in repos:
get_stars.submit(repo)
# call the flow!
if __name__ == "__main__":
github_stars(["PrefectHQ/Prefect", "PrefectHQ/prefect-aws", "PrefectHQ/prefect-dbt"])
Jeff Hale
09/02/2022, 8:11 PMAdam Brusselback
09/02/2022, 8:59 PMJenny
09/02/2022, 9:03 PM