rubby0605 / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Does not work behind proxy. #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is the error i get:

Traceback (most recent call last):
  File "/usr/bin/google", line 448, in <module>
    main()
  File "/usr/bin/google", line 442, in main
    run_once(options, args)
  File "/usr/bin/google", line 320, in run_once
    if client.RequestAccess():
  File "/usr/lib/python2.6/site-packages/googlecl/service.py", line 197, in request_access
    request_token = self.FetchOAuthRequestToken()
  File "/usr/lib/python2.6/site-packages/gdata/service.py", line 416, in FetchOAuthRequestToken
    response = self.http_client.request('GET', str(request_token_url))
  File "/usr/lib/python2.6/site-packages/atom/http.py", line 132, in request
    connection = self._prepare_connection(url, all_headers)
  File "/usr/lib/python2.6/site-packages/atom/http.py", line 240, in _prepare_connection
    p_sock.connect((proxy_url.host, int(proxy_url.port)))
  File "<string>", line 1, in connect
TypeError: coercing to Unicode: need string or buffer, NoneType found

I have set the proxy in the env variables (both http and https)

Original issue reported on code.google.com by jckeert...@gmail.com on 18 Jun 2010 at 9:53

GoogleCodeExporter commented 8 years ago
There is an article "Using Proxy Servers with the Google Data API Client 
Libraries", but it was written in 2007 and, alas, doesn't mention Python. 

Original comment by willison...@googlemail.com on 21 Jun 2010 at 6:33

GoogleCodeExporter commented 8 years ago
I have the same issue.

Are there any chances the proxy support will be implemented soon?

Original comment by anten...@gmail.com on 21 Jun 2010 at 7:59

GoogleCodeExporter commented 8 years ago
I solved the issue on my PC...

I downloaded and installed an updated version of python gdata (gdata-2.0.10) 
and then I set the http_proxy and https_proxy variables (both).

Original comment by anten...@gmail.com on 21 Jun 2010 at 8:53

GoogleCodeExporter commented 8 years ago
I set both http_proxy and https_proxy in my env, but I still get the same error:

C:\Docs\Apps\Python26> google docs list
Please specify user: ******
Traceback (most recent call last):
  File "C:\Docs\Apps\Python26\googlecl-0.9.7\src\google", line 463, in <module>
    main()
  File "C:\Docs\Apps\Python26\googlecl-0.9.7\src\google", line 457, in main
    run_once(options, args)
  File "C:\Docs\Apps\Python26\googlecl-0.9.7\src\google", line 340, in run_once
    if client.RequestAccess():
  File "C:\Docs\Apps\Python26\googlecl-0.9.7\src\googlecl\service.py", line 198, in request_access
    request_token = self.FetchOAuthRequestToken(extra_parameters=params)
  File "C:\Docs\Apps\Python26\lib\site-packages\gdata\service.py", line 416, in FetchOAuthRequestToken
    response = self.http_client.request('GET', str(request_token_url))
  File "C:\Docs\Apps\Python26\lib\site-packages\atom\http.py", line 132, in request
    connection = self._prepare_connection(url, all_headers)
  File "C:\Docs\Apps\Python26\lib\site-packages\atom\http.py", line 240, in _prepare_connection
    p_sock.connect((proxy_url.host, int(proxy_url.port)))
  File "<string>", line 1, in connect
TypeError: coercing to Unicode: need string or buffer, NoneType found

I am using these versions, on win xp (32bit):
- python-2.6.5 (on a non-standard path: C:\Docs\Apps\Python26)
- gdata-2.0.10
- googlecl-0.9.7

Original comment by ber...@gmail.com on 21 Jun 2010 at 3:25

GoogleCodeExporter commented 8 years ago
Works for me behind a proxy.

What user-agent is being passed? Sometimes (this happened to me recently) a 
proxy will check for an authorized user-agent.

python 2.5.6
Gdata 2.0.10
googecl 0.9.7

Original comment by timet...@gmail.com on 21 Jun 2010 at 5:31

GoogleCodeExporter commented 8 years ago
After installing Gdata 2.0.10 it now works.

Original comment by jckeert...@gmail.com on 21 Jun 2010 at 10:27

GoogleCodeExporter commented 8 years ago
I'll add this information to the FAQ. Thanks to everyone who reported in with 
problems and the solution.

Has anyone else had a problem with operating googlecl behind a proxy after 
updating to gdata-python-client 2.0.10? If so, I'll re-open this issue.

Original comment by tom.h.mi...@gmail.com on 22 Jun 2010 at 6:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Seems like it does work for me too on gdata 2.0.10 too. :) 
Though suddenly discovered that the problem was slightly different- I had tried 
<code>set HTTP_PROXY="http://<proxyservername>:<port>"<code> and it didn't 
work. Today tried it without the quotes i.e. <code>set 
HTTP_PROXY=http://<proxyservername>:<port><code> and it worked. That shouldn't 
happen but might be a windows shell thing. My environment was Windows 7.

Original comment by mat...@gmail.com on 22 Jun 2010 at 7:42

GoogleCodeExporter commented 8 years ago
Hi, the problem was the syntax of my http_proxy variable.
Before the installation, this variable was already set to a value in the 
"<proxyservername>:<port>" form, which is recognized by wget.
Then I switched to the form "<protocol>://<proxyservername>:<port>", so:

  set http_proxy=http://myproxy:8080
  set https_proxy=https://myproxy:8080

It worked.

Suggestion:
You could assume that protocol is http, if not specified.
Some people may found this environment variable already set in the implicit 
form, and could have no administrative rights to change it in the windows 
system properties. (Sure, they can still set these variables into the command 
line...)

Original comment by ber...@gmail.com on 23 Jun 2010 at 9:46