What steps will reproduce the problem?
1. export https_proxy=http://some.proxy.address:portnumber
Note the "http" scheme, not "https".
2. Run the following code:
# The constants CLIENT_ID, CLIENT_SECRET, SCOPES, USER_AGENT and REDIRECT_URI
must be suitably defined.
print "Generating the request token..."
token = gdata.gauth.OAuth2Token(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET, scope=" ".join(SCOPES), user_agent=USER_AGENT)
print "Request token:", token
print "Authorising the request token..."
print 'Visit the following URL in your browser to authorize this app:'
print str(token.generate_authorize_url(redirect_url=REDIRECT_URI))
print 'After agreeing to authorise the app, copy the verification code from the
browser.'
access_code = raw_input('Please enter the verification code: ')
print "Getting the access token..."
token.get_access_token(access_code)
print "Access token:", token
What is the expected output? What do you see instead?
Expect to see a string repr of the access token:
--------------------------------------------------------------------------------
--------
Generating the request token...
Request token: <gdata.gauth.OAuth2Token object at 0xce9650>
Authorising the request token...
Visit the following URL in your browser to authorize this app:
https://accounts.google.com/o/oauth2/auth?<REMOVED>
After agreeing to authorise the app, copy the verification code from the
browser.
Please enter the verification code: <REMOVED>
Getting the access token...
Access token: <gdata.gauth.OAuth2Token object at 0xce9650>
--------------------------------------------------------------------------------
--------
Instead I see:
--------------------------------------------------------------------------------
--------
Generating the request token...
Request token: <gdata.gauth.OAuth2Token object at 0x19c9610>
Authorising the request token...
Visit the following URL in your browser to authorize this app:
https://accounts.google.com/o/oauth2/auth?<REMOVED>
After agreeing to authorise the app, copy the verification code from the
browser.
Please enter the verification code: <REMOVED>
Getting the access token...
Traceback (most recent call last):
File "./gdocs_example.py", line 54, in <module>
token.get_access_token(access_code)
File "/usr/lib/python2.7/site-packages/gdata/gauth.py", line 1306, in get_access_token
response = http_client.request(http_request)
File "/usr/lib/python2.7/site-packages/atom/http_core.py", line 424, in request
http_request.headers, http_request._body_parts)
File "/usr/lib/python2.7/site-packages/atom/http_core.py", line 493, in _http_request
connection.endheaders()
File "/usr/lib64/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/usr/lib64/python2.7/httplib.py", line 776, in send
self.connect()
File "/usr/lib64/python2.7/httplib.py", line 1157, in connect
self.timeout, self.source_address)
File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 111] Connection refused
--------------------------------------------------------------------------------
--------
What version of the product are you using?
2.0.17.
Please provide any additional information below.
OS: Linux (Fedora 16), x86_64
If I patch src/gdata/gauth.py to use ProxiedHttpClient instead of HttpClient
(https://code.google.com/r/jimlawton-proxyfix/source/detail?r=7b09b64faff4282e99
4794ebd34f2e15b502ca77) the sequence then works as I expect.
Original issue reported on code.google.com by jim.law...@gmail.com on 21 May 2012 at 2:31
Original issue reported on code.google.com by
jim.law...@gmail.com
on 21 May 2012 at 2:31