michalczaplinski/pitchfork

.year() function does not work as intended

dhaynespls opened this issue · 1 comments

Caught in unit testing:

https://travis-ci.org/bruno207/pitchfork/jobs/187940542#L252

Sample run:

> python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pitchfork
>>> p = pitchfork.search('mogwai', 'come on')
>>> p.year()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bruno207/.local/lib/python3.5/site-packages/pitchfork/pitchfork.py", line 94, in year
    year = self.soup.find(class_='year').contents[1].get_text()
  File "/home/bruno207/.local/lib/python3.5/site-packages/bs4/element.py", line 730, in __getattr__
    self.__class__.__name__, attr))
AttributeError: 'NavigableString' object has no attribute 'get_text'
>>> 

This issue has been addressed by #13. We intend now to keep this project up to date. Please continue to contribute!