Skip to content Skip to sidebar Skip to footer

Python: Attributeerror: 'resultset' Object Has No Attribute 'get'

When I try to scrape a value from a website and put it into a payload request I get the error: AttributeError: 'ResultSet' object has no attribute 'get' This is my code: resumeUR

Solution 1:

Taken straight from the beautiful soup documentation:

AttributeError: 'ResultSet' object has no attribute 'foo' - This usually happens because you expected find_all() to return a single tag or string. But find_all() returns a list of tags and strings–a ResultSet object. You need to iterate over the list and look at the .foo of each one. Or, if you really only want one result, you need to use find() instead of find_all().

So if you want all the results -and not just the one- you need to iterate over all your ResultSet (e.g. product) and look for the .get of each one. So something like:

forvalin product:
  #check the val.get('value') for each member of list
  print val.get('value')

Solution 2:

I think the get method should be used in one element of the ResultSet (not on the whole set). I mean, where you do:

product.get('value')

try:

product[0].get('value')

Post a Comment for "Python: Attributeerror: 'resultset' Object Has No Attribute 'get'"