Skip to content

Commit 41dafc7

Browse files
author
Nick Groenen
committed
Let MySecondLife._request_page() always return a BeautifulSoup instance
1 parent eff96c4 commit 41dafc7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

secondlife.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ def _request_page(self, url):
6161
raise SigninError(error)
6262
br.select_form(nr=0)
6363
br.submit()
64-
return br.response().read()
64+
return BeautifulSoup(br.response().read())
6565

66-
def _extract_friends_from_html(self, html):
66+
def _extract_friends_from_html_soup(self, soup):
6767
friends = []
68-
soup = BeautifulSoup(html)
6968
friendsoup = soup.find_all("div", class_="main-content-body")
7069
assert len(friendsoup) == 1
7170
friendsoup = friendsoup[0].find_all("li")
@@ -77,5 +76,5 @@ def _extract_friends_from_html(self, html):
7776

7877
def friends_online(self):
7978
html = self._request_page("https://secondlife.com/my/account/friends.php?")
80-
assert self.br.title() == "Friends Online | Second Life"
81-
return self._extract_friends_from_html(html)
79+
assert html.title.string == "Friends Online | Second Life"
80+
return self._extract_friends_from_html_soup(html)

0 commit comments

Comments
 (0)