From 7aa1e61c7d845eface9a2be6ef9f8084973919c6 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 15 Feb 2013 21:25:42 -0500 Subject: [PATCH 1/1] scrape.nasdaq: Convert to BeautifulSoup v4 No change in the usage, except that the class attribute is now a list. --- insider/scrape/nasdaq.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.26.2