Windows Live Login API SSL issue - Python -
i'm writing program invite several windows live contacts web application, in django 1.4. i'm experiencing following problem.
i'm able log user in windows live using account credentials through windows live rest api using piece of code
def hotmail(request): auth_params = { 'client_id': settings.hotmail_key, 'scope': 'wl.basic', 'response_type': 'code', 'redirect_uri': 'http://my_testing_comain/hotmail/process' } auth_url = settings.hotmail_auth_url % urllib.urlencode(auth_params) return httpresponseredirect(auth_url) then, receive authorization code exchange access token (according oauth protocol) piece of code use process windows live's response:
def hotmail_process(request): if request.method == 'get': parameters = { 'code': request.get['code'], 'grant_type': 'authorization_code', 'redirect_uri': 'http://my_testing_url/hotmail/process', 'client_id': settings.hotmail_key, 'client_secret': settings.hotmail_secret, } response = urllib2.urlopen(settings.hotmail_auth_url % urllib.urlencode(parameters)).read() response = simplejson.loads(response) consumer = oauth.consumer(settings.hotmail_key, settings.hotmail_secret) client = oauth.client(consumer) contacts = client.request(settings.hotmail_user_friends_uri % response['access_token']) return httpresponse(simplejson.loads(contacts)) return httpresponse('invalid request') but following error:
sslhandshakeerror @ /hotmail/process/ [errno 1] _ssl.c:499: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed request method: request url: http://my_testing_url/hotmail/process/?code=5330307c-664c-4d5b-27b3-a19a97bc8546 django version: 1.4 exception type: sslhandshakeerror exception value: [errno 1] _ssl.c:499: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed , following traceback: environment: request method: request url: http://my_testing_url/hotmail/process/?code=5330307c-664c-4d5b-27b3-a19a97bc8546 django version: 1.4 python version: 2.7.1 installed applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'contacts') installed middleware: ('django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware') traceback: file "/home/user/virtenvs/israel/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) file "/home/user/virtenvs/israel/networks/contacts/views.py" in hotmail_process 26. contacts = client.request(settings.hotmail_user_friends_uri % response['access_token']) file "/home/user/virtenvs/israel/lib/python2.7/site-packages/oauth2/__init__.py" in request 682. connection_type=connection_type) file "/home/user/virtenvs/israel/lib/python2.7/site-packages/httplib2/__init__.py" in request 1544. (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey) file "/home/user/virtenvs/israel/lib/python2.7/site-packages/httplib2/__init__.py" in _request 1294. (response, content) = self._conn_request(conn, request_uri, method, body, headers) file "/home/user/virtenvs/israel/lib/python2.7/site-packages/httplib2/__init__.py" in _conn_request 1230. conn.connect() file "/home/user/virtenvs/israel/lib/python2.7/site-packages/httplib2/__init__.py" in connect 1005. raise sslhandshakeerror(e) exception type: sslhandshakeerror @ /hotmail/process/ exception value: [errno 1] _ssl.c:499: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed the thing that, if delete line client.request() this:
return httpresponseredirect(settings.hotmail_user_friends_uri % response['access_token']) i contacts in json format in browser
so, apparently, python oauth2 lib missing certificates (or that's think), tried python - ssl issue oauth2 no results. tried libraries before found out deprecated. i've tried plain rest api call got "forbiden" response.
my oauth2 library works fine because able implement same functionality gmail.
any or hint appreciated.
thank in advance.
why not this?
jcts = urlib2.urlopen(settings.hotmail_user_friends_uri % response['access_token']) contacts = simplejson.loads(jcts)
Comments
Post a Comment