I am trying to scrape heading from an Amazon listing. But it seems there is some error in my proxy. Here is the code I've tried:
import requests
from bs4 import BeautifulSoup
url="https://www.amazon.com/Kindle-Paperwhite-Essentials-Bundle-including/dp/B0898ZK226/ref=sr_1_3?dchild=1&keywords=kindle&qid=1597051671&sr=8-3"
headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"}
proxyDict = {
"http": "http://10.10.1.10:3128",
"https": "http://10.10.1.10:1080",
"ftp" : "ftp://10.10.1.10:3128"
}
page = requests.get(url, headers=headers, proxies=proxyDict) #Error here.
print(page.status_code)
soup = BeautifulSoup(page.content, "html.parser")
title = soup.find(id = "productTitle")
if title:
title = title.get_text().strip()
else:
title = "Title: Error 404"
print(title)
Without a proxy, Code shows None in output.