2023-10-04 08:11:53 -07:00
|
|
|
from homeharvest import scrape_property
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
# Generate filename based on current timestamp
|
|
|
|
current_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
2023-10-04 19:50:54 -07:00
|
|
|
filename = f"HomeHarvest_{current_timestamp}.csv"
|
2023-10-04 08:11:53 -07:00
|
|
|
|
|
|
|
properties = scrape_property(
|
|
|
|
location="San Diego, CA",
|
2023-10-04 20:33:21 -07:00
|
|
|
listing_type="sold", # or (for_sale, for_rent)
|
2023-10-04 21:35:14 -07:00
|
|
|
past_days=30, # sold in last 30 days - listed in last x days if (for_sale, for_rent)
|
2023-10-04 20:33:21 -07:00
|
|
|
# pending_or_contingent=True # use on for_sale listings to find pending / contingent listings
|
|
|
|
# mls_only=True, # only fetch MLS listings
|
|
|
|
# proxy="http://user:pass@host:port" # use a proxy to change your IP address
|
2023-10-04 08:11:53 -07:00
|
|
|
)
|
|
|
|
print(f"Number of properties: {len(properties)}")
|
|
|
|
|
|
|
|
# Export to csv
|
|
|
|
properties.to_csv(filename, index=False)
|
2023-10-04 19:50:54 -07:00
|
|
|
print(properties.head())
|