Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Handle 404 for profile image properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Wang committed May 6, 2017
1 parent fcf3d90 commit af27d54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions restapi/utils/circlise.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
def getProfilePic(userID):
"""Return compressed version of a user's profile pic."""
# Get profile image from Facebook.
response = request.urlopen('http://graph.facebook.com/' +
str(userID) + '/picture?type=square')

if response.code != 200:
try:
response = request.urlopen('http://graph.facebook.com/' +
str(userID) + '/picture?type=square')
except Exception as e:
return ""

# Make the image a circle.
Expand Down

0 comments on commit af27d54

Please sign in to comment.