Skip to content

Commit

Permalink
replace urllib with urllib2 to perform authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
gaubert committed Sep 14, 2015
1 parent b3027ca commit ee915c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gmv/credential_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import webbrowser
import json
import base64
import urllib
import urllib #for urlencode
import urllib2

import os
import getpass
Expand Down Expand Up @@ -260,7 +261,7 @@ def _get_oauth2_acc_tok_from_ref_tok(cls, refresh_token):
request_url = '%s/%s' % (account_base_url, 'o/oauth2/token')

try:
response = urllib.urlopen(request_url, urllib.urlencode(params)).read()
response = urllib2.urlopen(request_url, urllib.urlencode(params)).read()
except Exception, err: #pylint: disable-msg=W0703
LOG.critical("Error: Problems when trying to connect to Google oauth2 endpoint: %s.\n" % (request_url))
raise err
Expand Down Expand Up @@ -299,7 +300,7 @@ def _get_authorization_tokens(cls, authorization_code):
request_url = '%s/%s' % (account_base_url, 'o/oauth2/token')

try:
response = urllib.urlopen(request_url, urllib.urlencode(params)).read()
response = urllib2.urlopen(request_url, urllib.urlencode(params)).read()
except Exception, err: #pylint: disable-msg=W0703
LOG.critical("Error: Problems when trying to connect to Google oauth2 endpoint: %s." % (request_url))
raise err
Expand Down

0 comments on commit ee915c2

Please sign in to comment.