juliomalegria / python-craigslist

Simple Craigslist wrapper
MIT No Attribution
387 stars 117 forks source link

Bug in example code #18

Closed adam-abdulhamid closed 8 years ago

adam-abdulhamid commented 8 years ago

Here is the housing example:

from craigslist import CraigslistHousing

cl_h = CraigslistHousing(site='sfbay', area='sfc', category='roo',
                         filters={'max_price': 1200, 'private_room': True})

for result in cl_h.get_results(sort_by='newest', geotagged=True):
    print result

This was working about a week ago, but as of recently it throws an error (on the line with the for loop). The error is: File "/Library/Python/2.7/site-packages/craigslist/__init__.py", line 160, in get_results p_text = row.find('span', {'class': 'p'}).text AttributeError: 'NoneType' object has no attribute 'text'

Thanks

jctdickinson commented 8 years ago

For what it's worth, I get the same error in Python 3.5: File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/craigslist/__init__.py", line 160, in get_results p_text = row.find('span', {'class': 'p'}).text AttributeError: 'NoneType' object has no attribute 'text'

adam-abdulhamid commented 8 years ago

Ok looking at the last commit it looks like you this has been fixed, but upgrading the package via pip doesn't change it

navels commented 8 years ago

This worked for me:

pip install git+git://github.com/juliomalegria/python-craigslist.git@ebd99b5bc7afe9edb87bbe73843193dfdcfa1750 --upgrade
jctdickinson commented 8 years ago

Sweet. Ran that with a pip3 install and it appears to have done the trick. Many thanks.

adam-abdulhamid commented 8 years ago

Awesome, navels solution worked for me. Marking as closed!