"""
Basic example of scraping pipeline using CSVScraperGraph from CSV documents
"""
import os
import json
from dotenv import load_dotenv
import pandas as pd
from scrapegraphai.graphs import CSVScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
FILE_NAME = "inputs/username.csv"
curr_dir = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(curr_dir, FILE_NAME)
text = pd.read_csv(file_path)
graph_config = {
"llm": {
"client": "client_name",
"model": "bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
"temperature": 0.0
}
}
csv_scraper_graph = CSVScraperGraph(
prompt="List me all the last names",
source=str(text),
config=graph_config
)
result = csv_scraper_graph.run()
print(json.dumps(result, indent=4))