nesticot commited on
Commit
74ac67b
·
1 Parent(s): 7ea4826

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -611,7 +611,20 @@ def server(input, output, session):
611
 
612
  # ax[0][0].axis('off')
613
  # ax[1][0].axis('off')
614
- image = "https://cms.nhl.bamgrid.com/images/headshots/current/168x168/"+str(player_id)+".png"
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  logo = nhl_logos[nhl_logos.Team==list(player_games_one['Team'])[0]].reset_index().URL[0]
616
  #im = plt.imread('players/'+name+'_'+str(last_games)+'.png')
617
  #ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)
 
611
 
612
  # ax[0][0].axis('off')
613
  # ax[1][0].axis('off')
614
+ # image = "https://cms.nhl.bamgrid.com/images/headshots/current/168x168/"+str(player_id)+".png"
615
+
616
+ try:
617
+ image = "https://cms.nhl.bamgrid.com/images/headshots/current/168x168/"+str(player_id)+".png"
618
+ im = plt.imread(image)
619
+
620
+ except HTTPError as err:
621
+ if err.code == 403:
622
+ image = "https://cms.nhl.bamgrid.com/images/headshots/current/168x168/skater.png"
623
+ im = plt.imread(image)
624
+ else:
625
+ raise
626
+
627
+
628
  logo = nhl_logos[nhl_logos.Team==list(player_games_one['Team'])[0]].reset_index().URL[0]
629
  #im = plt.imread('players/'+name+'_'+str(last_games)+'.png')
630
  #ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)