Spaces:
Sleeping
Sleeping
File size: 2,773 Bytes
95a9f00 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
import requests
import pandas as pd
# Set your SerpAPI key
API_KEY = "533b5ecf4f322a3e1fb6c6341fc922267805add7e804f7783949a17175ed2f69"
BASE_URL = "https://serpapi.com/search"
def research_company(company_name):
"""Search for company information using SerpAPI."""
params = {
"engine": "google",
"q": f"{company_name} company overview",
"api_key": API_KEY,
"num": 10 # Number of results to return
}
# Perform the search using SerpAPI
response = requests.get(BASE_URL, params=params)
if response.status_code == 200:
data = response.json()
# Extracting relevant information
results = []
for item in data.get("organic_results", []):
title = item.get("title")
link = item.get("link")
snippet = item.get("snippet")
results.append({"Title": title, "Link": link, "Snippet": snippet})
return results
else:
print(f"Error fetching data: {response.status_code}")
return None
def identify_key_offerings():
"""Identify key offerings and focus areas."""
key_offerings = [
"Consulting Services",
"Audit Services",
"Tax Advisory",
"Risk Management",
"Financial Advisory",
"Technology Implementation"
]
focus_areas = [
"Operations",
"Supply Chain Management",
"Customer Experience",
"Digital Transformation",
"Sustainability",
"Cybersecurity"
]
return key_offerings, focus_areas
def save_results_to_csv(results, company_name):
"""Save research results to a CSV file."""
df = pd.DataFrame(results)
filename = f"{company_name}_research_results.csv"
df.to_csv(filename, index=False)
print(f"Results saved to {filename}")
return filename
if __name__ == "__main__":
company_name = "Deloitte"
print(f"Researching {company_name}...")
results = research_company(company_name)
if results:
print(f"\nResearch results for {company_name}:")
for i, item in enumerate(results):
print(f"{i + 1}: {item['Title']} - {item['Link']}")
print(f"Snippet: {item['Snippet']}\n")
key_offerings, focus_areas = identify_key_offerings()
print(f"\nKey Offerings of {company_name}:")
for offering in key_offerings:
print(f"- {offering}")
print(f"\nStrategic Focus Areas of {company_name}:")
for area in focus_areas:
print(f"- {area}")
# Save results to CSV
save_results_to_csv(results, company_name) |