headers = {
'Accept': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 OPR/89.0.4447.64',
'Referer': 'https://suchen.mobile.de/fahrzeuge/search.html?dam=0&isSearchRequest=true&ref=quickSearch&sb=rel&vc=Car',
'Cookie': ''
}
response = requests.get(url, headers=headers, verify=False).content
soup = BeautifulSoup(response, "html.parser")
carList = soup.find_all('div',{'class':'cBox-body cBox-body--resultitem'})
for car in carList:
carName = car.find("span",{"class":"h3 u-text-break-word"}).text
carPrice = car.find("span",{"class":"h3 u-block"}).text
carPrice = carPrice.replace("\xa0", " ");
returnResponse.append({
'carName': carName,
'carPrice': carPrice
})
time.sleep(10)
jsonFormattedString = json.dumps(returnResponse, indent=2)
fileManager = open('result.json', 'a')
fileManager.write(jsonFormattedString)
fileManager.close()
Merhabalar, bu şekilde verileri çekmeye çalıştıığımda ya ‘Unverified HTTPS request is being made to host’ hatası alıyorum ya da o hatayı da alamadan verileri ekemiyorum. Farkedemediğim ne gibi bir eksiklik bulunuyor.