import requests
from bs4 import BeautifulSoup
import json

# Define the URL of the events page
url = "https://wineryatbullrun.com/calendar/"

# Send a GET request to the webpage
response = requests.get(url)
data = []

# Check if the request was successful
if response.status_code == 200:
    # Parse the HTML content of the page
    soup = BeautifulSoup(response.text, 'html.parser')
    
    # Find all event articles by their class (this class is an example, adjust according to actual webpage)
    events = soup.find_all('article', class_='mec-event-article')
    
    for event in events:
        # Extract the desired information for each event
        name = event.find('h4', class_='mec-event-title').text.strip()
        location = event.find('div', class_='mec-event-loc-place').text.strip()
        date_time = event.find('div', class_='mec-event-date').text.strip()
        description = event.find('div', class_='mec-event-detail').text.strip()
        
        # Construct a dictionary for the event
        event_data = {
            'name': name,
            'location': location,
            'date_time': date_time,
            'description': description
        }
        
        # Add the event data to our data list
        data.append(event_data)

# Convert the list of events to a JSON object
json_data = json.dumps(data, indent=4)

# Print the JSON data
print(json_data)

