Script was working fine till last week but now it generates "AttributeError: 'NoneType' object has no attribute 'get_text'" error all the time
from pypartpicker import Scraper
from time import sleep
# returns a list of Part objects we can iterate through
# the region is set to "uk" so that we get prices in GBP
pcpp = Scraper(headers={ "cookie": "cf_clearance=XXXXXXXXXXXXXXXXXXXXXXXX; domain=.pcpartpicker.com; HttpOnly; Secure;", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" })
parts = pcpp.part_search("i3", region="uk")
# iterates through the parts
for part in parts:
# checks if the price is lower than 110
if float(part.price.strip("£")) <= 110:
print(f"I found a valid product: {part.name}")
print(f"Here is the link: {part.url}")
# gets the product object for the parts
product = pcpp.fetch_product(part.url)
print(product.specs)
# makes sure the product has reviews
if product.reviews != None:
# gets the first review
review = product.reviews[0]
print(f"Posted by {review.author}: {review.content}")
print(f"They rated this product {review.rating}/5.")
else:
print("There are no reviews on this product!")
# slows down the program so as not to spam PCPartPicker and potentially get IP banned
sleep(3)
Script was working fine till last week but now it generates "AttributeError: 'NoneType' object has no attribute 'get_text'" error all the time