Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add old game schedule data - some non working team names and no score data #117

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix Beautiful soup lxml dependency warning
  • Loading branch information
andr3w321 committed Sep 14, 2015
commit fe65a7b07c2d16dcd748716c77cc34b7c538fc06
17 changes: 15 additions & 2 deletions nflgame/update_players.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
import nflgame.live
import nflgame.player

try:
import lxml
except ImportError:
lxml_installed = False
else:
lxml_installed = True

urls = {
'roster': 'http:https://www.nfl.com/teams/roster?team=%s',
'gsis_profile': 'http:https://www.nfl.com/players/profile?id=%s',
Expand Down Expand Up @@ -120,7 +127,10 @@ def roster_soup(team):
resp, content = new_http().request(urls['roster'] % team, 'GET')
if resp['status'] != '200':
return None
return BeautifulSoup(content)
if lxml_installed:
return BeautifulSoup(content, "lxml")
else:
return BeautifulSoup(content)


def try_int(s):
Expand Down Expand Up @@ -190,7 +200,10 @@ def meta_from_profile_html(html):
if not html:
return html
try:
soup = BeautifulSoup(html)
if lxml_installed:
soup = BeautifulSoup(html, "lxml")
else:
soup = BeautifulSoup(html)
pinfo = soup.find(id='player-bio').find(class_='player-info')

# Get the full name and split it into first and last.
Expand Down