On Fri, 01 Mar 2013, Rick Herrick wrote:

>    In pyxnat/core/socks.py:

>  > @@ -0,0 +1,387 @@
>  > +"""SocksiPy - Python SOCKS module.

>    This is an unfortunate thing: httplib2 only appears to support proxies
>    using this particular socks library. If you look through the code there,
>    usage of the proxy is conditionalized based on having proxy attributes AND
>    having successfully imported socks. pyxnat only uses socks directly for
>    the constants but it's the dependency in httplib2 that makes it mandatory.

I see! thanks for the explanation:  on Debian systems fresh httplib2
(0.7.4-2)
apparently comes with socks:

```
$> dpkg -L python-httplib2 | grep socks   
/usr/share/pyshared/httplib2/socks.py
/usr/lib/python2.7/dist-packages/httplib2/socks.py
/usr/lib/python2.6/dist-packages/httplib2/socks.py
```
but not on older ones (e.g. 0.6.0-4)... haven't spotted obvious
"inclusion" message in changelogs besides that 0.7.0 stated:

   Sync to latest version of socks.py

so indeed might be wise to carry it, while making its import smarter --
checking if httplib2.socks exists and only if not, importing
pyxnat.externals.socks ... although then not sure if older httplib2's would be
compatible with socks anyways (probably it is -- do not see changelogs stating
fixes compatibilities...  do you know for sure? ;))

>    That said, I just found a [1]more up-to-date version on Google Code that
>    makes sense to use in place of this version. This version is taken from
>    the original code repo and is not available for install on pip, but
>    SocksiPy-branch is. I deleted this file and added SocksiPy-branch as a
>    dependency in setup.py.

hmm... although that one in 0.7.4 still differs from the one SocksiPy-branch-1.02 :

```
$> diff /usr/share/pyshared/httplib2/socks.py /tmp/SocksiPy-branch-1.02/socks.py | diffstat
 unknown |   62 +++-----------------------------------------------------------
 1 file changed, 3 insertions(+), 59 deletions(-)
```

but I would stick to the one in httplib2... may be even it got updated in 0.7.7
(avail in debian experimental).  Ideally we should try avoiding carrying
out/maintaining 3rd party library ESPECIALLY for its use by another 3rd party
library ;)

So -- if I were you I would have

1. removed socks.py
2. added a check if httplib2.socks is available

   - if it is not available and proxy specified -- issue a warning that
   proxy capability is not available because of missing socks in the provided
   httplib2

that should save more of gray hair  ;-)
-- 
Yaroslav O. Halchenko
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik