~ubuntuone-control-tower/ubuntu-sso-client/stable-1-2

« back to all changes in this revision

Viewing changes to ubuntu_sso/credentials.py

  • Committer: Tarmac
  • Author(s): Alejandro J. Cura
  • Date: 2012-06-22 19:51:52 UTC
  • mfrom: (689.1.2 use-pycurl-1-2)
  • Revision ID: tarmac-20120622195152-29b4mbt5fpbwlq9h
- Use pycurl instead of httplib (LP: #882055).

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
import sys
41
41
import traceback
42
 
import urllib2
43
42
 
44
43
from functools import wraps
45
44
 
49
48
from ubuntu_sso import NO_OP, utils
50
49
from ubuntu_sso.keyring import Keyring
51
50
from ubuntu_sso.logger import setup_logging
 
51
from ubuntu_sso.utils import curllib
52
52
 
53
53
 
54
54
logger = setup_logging('ubuntu_sso.credentials')
245
245
                                parameters=parameters)
246
246
        oauth_req.sign_request(oauth.OAuthSignatureMethod_HMAC_SHA1(),
247
247
                               consumer, token)
248
 
        request = urllib2.Request(url, headers=oauth_req.to_header())
249
 
        logger.debug('Opening the url "%s" with urllib2.urlopen.',
 
248
        request = curllib.Request(url, headers=oauth_req.to_header())
 
249
        logger.debug('Opening the url "%s" with curllib.urlopen.',
250
250
                     request.get_full_url())
251
251
        # This code is blocking, we should change this.
252
252
        # I've tried with deferToThread an twisted.web.client.getPage
253
253
        # but the returned deferred will never be fired (nataliabidart).
254
 
        response = urllib2.urlopen(request)
 
254
        response = curllib.urlopen(request)
255
255
        logger.debug('Url opened. Response: %s.', response.code)
256
256
        returnValue(response.code)
257
257