omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Unexpected HTTPError on Facebook's Internal Server Error #920

Closed ziima closed 7 years ago

ziima commented 8 years ago

In case Internal server error is returned by Facebook, unexpected HTTPError is raised. In my opinion, all exceptions from requests should be transformed to one of social auth exceptions by handle_http_errors utility.

Traceback from the unexpected error:

  File "/usr/lib/python2.7/dist-packages/social/actions.py", line 43, in do_complete
    user = backend.complete(user=user, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/social/backends/base.py", line 40, in complete
    return self.auth_complete(*args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/social/utils.py", line 202, in wrapper
    return func(*args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/social/backends/facebook.py", line 87, in auth_complete
    return self.do_auth(access_token, response, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/social/backends/facebook.py", line 104, in do_auth
    data = self.user_data(access_token)

  File "/usr/lib/python2.7/dist-packages/social/backends/facebook.py", line 57, in user_data
    return self.get_json(self.USER_DATA_URL, params=params)

  File "/usr/lib/python2.7/dist-packages/social/backends/base.py", line 225, in get_json
    return self.request(url, *args, **kwargs).json()

  File "/usr/lib/python2.7/dist-packages/social/backends/base.py", line 221, in request
    response.raise_for_status()

  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 851, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

HTTPError: 500 Server Error: Internal Server Error