Created
April 11, 2016 14:38
-
-
Save andre-manoel/f0239fb0a2d5deaf15331f4bfe6a827f to your computer and use it in GitHub Desktop.
Error 503
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
import bs4 | |
import requests | |
def getAmazonPrice(productUrl): | |
res = requests.get(productUrl) | |
res.raise_for_status() | |
soup = bs4.BeautifulSoup(res.text, 'html.parser') | |
elems = soup.select('#newOfferAccordionRow .header-price') | |
return elems[0].text.strip() | |
price = getAmazonPrice('http://www.amazon.com/Automate-Boring-Stuff-Python-Programming/dp/1593275994/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=&sr=') | |
print('The price is ' + price) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment