0

I have the following html code:

<div class="panel panel-default box">
<div class="panel-heading">
<h2 class="panel-title">December 2015</h2>
</div>
<div class="panel-body">
<ul>
    <li>December 30, 2015 - <a href="link">Report</a></li>
    <li>December 23, 2015 - <a href="link">Report</a></li>
    <li>December 16, 2015 - <a href="link">Report</a></li>
    <li>December 9, 2015 - <a href="link">Report</a></li>
    <li>December 2, 2015 - <a href="link">Report</a></li>
</ul>
</div>
</div>

I wrote the following python code to scrape some of the content above.

from bs4 import BeautifulSoup
import lxml
import requests
import textwrap
import csv

BASE_URL = "link"
response = requests.get(BASE_URL)
html = response.content

#each monthly list starts with <div class="panel-body">
soup = BeautifulSoup(html,"lxml")

list_of_links = soup.findAll('div', attrbs={'class': "panel-body"})

print list_of_links

For some reason Python keeps returning an empty "list_of_links"

Does anyone know what I'm doing wrong?

Thanks.

1 Answer 1

1

You seem to have a typo here:

attrbs={'class': "panel-body"})

Should be attrs, not attrbs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.