Is anyone familiar with the ‘AttributeError: ‘NoneType’ object has no attribute ‘get_text’ error when trying to search with the PyPartpicker API?`
Even the example code:
from pypartpicker import Scraper
# creates the scraper object
pcpp = Scraper()
# returns a list of Part objects we can iterate through
parts = pcpp.part_search("i7")
# iterates through every part object
for part in parts:
# prints the name of the part
print(part.name)
# gets the first product and fetches its URL
first_product_url = parts[0].url
# gets the Product object for the item
product = pcpp.fetch_product(first_product_url)
# prints the product's specs using the specs attribute
print(product.specs)
Returns this error:
Traceback (most recent call last):
File "/workspaces/pcpartpickertest/index.py", line 7, in <module>
parts = pcpp.part_search("i7")
File "/home/codespace/.python/current/lib/python3.10/site-packages/pypartpicker/scraper.py", line 232, in part_search
soup = self.__make_soup(f"{search_link}&page={i + 1}")
File "/home/codespace/.python/current/lib/python3.10/site-packages/pypartpicker/scraper.py", line 95, in __make_soup
if "Verification" in soup.find(class_="pageTitle").get_text():
AttributeError: 'NoneType' object has no attribute 'get_text'
I’m struggling to fing any documentation apart from the offical Github page so if anyone could provide any docs or ideas that would be much appreciated!
I’ve tried everything, including removing the Search object all together, please help!
New contributor
Stylus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.