From: W. Trevor King Date: Sat, 16 Feb 2013 02:25:42 +0000 (-0500) Subject: scrape.nasdaq: Convert to BeautifulSoup v4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7aa1e61c7d845eface9a2be6ef9f8084973919c6;p=insider.git scrape.nasdaq: Convert to BeautifulSoup v4 No change in the usage, except that the class attribute is now a list. --- diff --git a/insider/scrape/nasdaq.py b/insider/scrape/nasdaq.py index 5a1e616..0f49e87 100644 --- a/insider/scrape/nasdaq.py +++ b/insider/scrape/nasdaq.py @@ -5,7 +5,7 @@ import datetime import decimal import urllib2 -from BeautifulSoup import BeautifulSoup +from bs4 import BeautifulSoup from insider.models import add_transaction @@ -68,7 +68,8 @@ def get_trades(ticker): elif field == '': line_match = True break # we made it to the end of the list - if dict(tds[i].attrs).get('class', None) != class_: + classes = dict(tds[i].attrs).get('class', []) + if class_ and class_ not in classes: break # wrong class value = tds[i].text if class_ == 'Holdnum': # decode numerical values