import httpx from beakers.recipe import Recipe, Beaker async def add_response(obj_with_url): print(obj_with_url["url"]) url = obj_with_url["url"] response = await httpx.get(url) return { "url": url, "status_code": response.status_code, "response_body": response.text, } # current thinking, beakers exist within a recipe recipe = Recipe("fetch urls") recipe.declare_beaker("agencies") recipe.declare_beaker("responses") recipe.declare_beaker("good_urls", temp=True) recipe.declare_beaker("missing_urls", temp=True) recipe.csv_to_beaker("agencies.csv", "agencies") recipe.add_split( "agencies", lambda x: x["url"].startswith("http"), if_true="good_urls", if_false="missing_urls", ) recipe.add_pour("good_urls", "responses", add_response) recipe.run_linearly()