import requests import time # The endpoint you built in main.py API_URL = "http://127.0.0.1:8000/crawl/dispatch" # The workspace profile to upload this data into WORKSPACE_PROFILE = "public" # The websites you want Vertex to learn seed_urls = [ "https://en.wikipedia.org/wiki/Search_engine", "https://en.wikipedia.org/wiki/Vector_database", "https://en.wikipedia.org/wiki/Retrieval-augmented_generation", "https://en.wikipedia.org/wiki/Distributed_computing" ] print(f"šŸš€ Starting Vertex Bulk Ingestion into workspace: '{WORKSPACE_PROFILE}'\n") for url in seed_urls: payload = { "url": url, "user_profile": WORKSPACE_PROFILE } try: # Send the URL to FastAPI response = requests.post(API_URL, json=payload) if response.status_code == 200: data = response.json() print(f"āœ… [QUEUED] {url}") print(f" Task ID: {data['task_id']}") else: print(f"āŒ [FAILED] {url} - {response.text}") except requests.exceptions.ConnectionError: print("āŒ [ERROR] Could not connect to FastAPI. Is uvicorn running in your other terminal?") break # Pause for half a second so we don't overwhelm the local server time.sleep(0.5) print("\nšŸŽ‰ All URLs dispatched! Watch your Celery terminal to see the AI extracting the data.")