This is due to a typo in the this line: if detailed: data['stories'].extend( _parse_stories_page(parse_url(sthref), st) ) should be _parse_url