Created
May 12, 2020 02:28
-
-
Save offsetkeyz/e9e7b93625cce1bf28d45b042cd8e015 to your computer and use it in GitHub Desktop.
Requests with Beautiful Soup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_author_ = "Colin McAllister (Offset Colin)" | |
import requests | |
from bs4 import BeautifulSoup | |
request = requests.get("https://www.johnlewis.com/herman-miller-aeron-office-chair-graphite/p3177252") | |
content = request.content | |
soup = BeautifulSoup(content, "html.parser") | |
element = soup.find("p", "price price--large") | |
price = float(element.text.strip('£').replace(',', '')) | |
print(price) | |
#<p class="price price--large">£1,099.00</p> | |
# print(request.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment