import requests
from bs4 import BeautifulSoup
card_name = 'Goblin Balloon Brigade'
formatted_card_name = card_name.replace(' ', '+')
# Updating URL to take in formatted_card_name to update search results
url = f"https://www.tcgplayer.com/search/magic/product?productLineName=magic&productName={formatted_card_name}&Language=English&view=grid&page=1"
# Send a GET request to the URL
response = requests.get(url)
`Preformatted text`# Check if the request was successful (status code 200)
if response.status_code == 200:
# Parse the HTML content of the page
soup = BeautifulSoup(response.text, 'html.parser')
# Find the price element on the page (you may need to inspect the HTML to find the appropriate tag and class)
price_element = soup.find('span', class_="inventory__price-with-shipping")
# Extract the price text
price = price_element.text.strip()# if price_element else "Price not found"
print("Card Price:", price)
else:
print("Failed to retrieve the webpage. Status code:", response.status_code)