salimoha / googlecl

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

ValueError after succesful account authentication #117

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. installed gdata from tar.gz
2. installed googlecl from tar.gz
3. starting first time auth any service
4. pressing enter after succesful auth

What is the expected output? What do you see instead?
Expected to work, but getting:

Traceback (most recent call last):
  File "/usr/local/bin/google", line 463, in <module>
    main()
  File "/usr/local/bin/google", line 457, in main
    run_once(options, args)
  File "/usr/local/bin/google", line 330, in run_once
    token_valid = client.IsTokenValid()
  File "/usr/local/lib/python2.6/dist-packages/googlecl/calendar/service.py", line 265, in is_token_valid
    return googlecl.service.BaseServiceCL.IsTokenValid(self, test_uri)
  File "/usr/local/lib/python2.6/dist-packages/googlecl/service.py", line 170, in is_token_valid
    self.Get(test_uri)
  File "/usr/local/lib/python2.6/dist-packages/gdata/service.py", line 1069, in Get
    headers=extra_headers)
  File "/usr/local/lib/python2.6/dist-packages/atom/__init__.py", line 93, in optional_warn_function
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/atom/service.py", line 186, in request
    data=data, headers=all_headers)
  File "/usr/local/lib/python2.6/dist-packages/gdata/auth.py", line 868, in perform_request
    return http_client.request(operation, url, data=data, headers=headers)
  File "/usr/local/lib/python2.6/dist-packages/atom/http.py", line 132, in request
    connection = self._prepare_connection(url, all_headers)
  File "/usr/local/lib/python2.6/dist-packages/atom/http.py", line 278, in _prepare_connection
    return httplib.HTTPConnection(proxy_url.host, int(proxy_url.port))
ValueError: invalid literal for int() with base 10: 'MYPASSWORD@IP-OF-PROXY'

What version of the product are you using? On what operating system?
-Ubuntu 9.04 32bit
-Python 2.6.2
-gdata-2.0.10
-googlecl-0.9.7

Please provide any additional information below:
Network access through squid proxy with authentication, and the Error states my 
password in cleartext with @ sign and followed by the proxy-IP

Original issue reported on code.google.com by nagy.ger...@gmail.com on 21 Jun 2010 at 6:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I set the following env vars:

http_proxy=http://..
https_proxy=http://..
proxy_username=...
proxy_password=...

...and this has some effect - I no longer get a timeout or "Proxy 
Authentication Required" message, so I believe the values to be correct.

However, I still get the following error:

Traceback (most recent call last):
  File "src/google", line 463, in <module>
    main()
  File "src/google", line 457, in main
    run_once(options, args)
  File "src/google", line 330, in run_once
    token_valid = client.IsTokenValid()
  File "/home/seed/Downloads/googlecl-0.9.7/src/googlecl/calendar/service.py", line 265, in is_token_valid
    return googlecl.service.BaseServiceCL.IsTokenValid(self, test_uri)
  File "/home/seed/Downloads/googlecl-0.9.7/src/googlecl/service.py", line 170, in is_token_valid
    self.Get(test_uri)
  File "/usr/lib/python2.6/site-packages/gdata/service.py", line 1092, in Get
    encoding=encoding, converter=converter)
  File "/usr/lib/python2.6/site-packages/gdata/service.py", line 1103, in Get
    'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 401, 'body': 
'<HTML>\n<HEAD>\n<TITLE>Unknown authorization header</TITLE>\n</HEAD>\n<BODY 
BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Unknown authorization 
header</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Unknown 
authorization header'}

Original comment by paulse...@gmail.com on 22 Jun 2010 at 7:35

GoogleCodeExporter commented 9 years ago
Interesting idea, and this worked for me:
export http_proxy= ; google COMMAND

the "MYPASSWORD@IP-OF-PROXY" is a part of 
http_proxy=http://MYUSER:MYPASSWORD@IP-OF-PROXY:PROXYPORT/ variable (yes the 
proxy pass is same like my google acc pass, i changed it ...)

But this seems that the googlecl has problems with this env variable??

Original comment by nagy.ger...@gmail.com on 25 Jun 2010 at 7:26

GoogleCodeExporter commented 9 years ago
I took a peek at the code that handles this, and it's a limitation of the atom 
library. When parsing the proxy url, it does a (pretty unintelligent) split on 
':' in 'MYUSER:MYPASSWORD@IP-OF-PROXY:PROXYPORT' and takes the first element as 
the url and the second as the port.

So, the atom library (and therefore gdata and therefore googlecl) won't accept 
anything for http_proxy except 'http://url:port'. There's more info in the FAQ 
under Troubleshooting.

paulseed1, are those typos for your proxy settings? http_proxy=http://. sounds 
like it will definitely fail, as "." isn't much of a url. Regardless, could you 
try running the failing command with googlecl 0.9.9 and using the --debug flag?

Original comment by tom.h.mi...@gmail.com on 30 Jul 2010 at 5:54

GoogleCodeExporter commented 9 years ago
Issue 324 has been merged into this issue.

Original comment by tom.h.mi...@gmail.com on 4 Nov 2010 at 10:00

GoogleCodeExporter commented 9 years ago
I found a related issue in the gdata bug tracker here: 
http://code.google.com/p/gdata-python-client/issues/detail?id=414

Please star that issue to show you want the problem resolved.  I'll still look 
at getting some kind of workaround into GoogleCL, but the best method to 
resolve this problem is to get a patch accepted into the gdata python client.

Original comment by tom.h.mi...@gmail.com on 4 Nov 2010 at 10:03

GoogleCodeExporter commented 9 years ago
So I decided to tackle the issue myself, and poking around the source code, I 
found something that might work.

Set the environment variables proxy_username and proxy_password, and take that 
info out of http_proxy and https_proxy. That is, go from this:

http_proxy=http://user:password@host:port

to

http_proxy=http://host:port
proxy_username=user
proxy_password=password

Original comment by tom.h.mi...@gmail.com on 4 Nov 2010 at 11:06