Commits

Martin von Löwis committed 6c644bc

Catch HTTP errors in associate.

Comments (0)

Files changed (1)

openid2rp/__init__.py

             data['openid.session_type'] = ''
         del data['openid.ns']
     res = urllib.urlopen(url, urllib.urlencode(data))
+    if res.getcode() != 200:
+        raise ValueError, "OpenID provider refuses connection with status %d" % res.getcode()
     data = parse_response(res.read())
     if 'error' in data:
         raise ValueError, "associate failed: "+data['error']