简体   繁体   English

python肥皂水和袜子

[英]python suds and socksipy

I have a little problem using suds with socks. 我在袜子上混用肥皂水有点麻烦。

I have a SSH tunnel ( ssh -vD 9999 user@server), and I must send/retrieve data using suds into the tunnel. 我有一个SSH隧道(ssh -vD 9999 user @ server),我必须使用suds向隧道发送/检索数据。

So here is my code : 所以这是我的代码:

from suds.client import Client
import socks
import urllib2

old = urllib2.socket.socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9999)
socks.wrapmodule(urllib2)# Suds use urllib2
client = Client(wsdl)

But it's not working, I get from the .py : 但是它不起作用,我从.py得到:

socks.GeneralProxyError: (0, 'connection closed unexpectedly')

And from my SSH tunnel : 从我的SSH隧道:

debug1: Connection to port 9999 forwarding to socks port 0 requested.
debug1: channel 2: new [dynamic-tcpip]
channel 2: open failed: connect failed: Connection refused
debug1: channel 2: free: direct-tcpip: listening port 9999 for 127.0.0.1 port 3000, connect from 127.0.0.1 port 42219, nchannels 3

But if instead of instantiate Client, I do juste an urllib2.urlopen('google.fr'), it's working. 但是,如果我没有实例化客户端,我只是使用urllib2.urlopen('google.fr'),它就可以了。

So I don't know what I do wrong. 所以我不知道我做错了什么。

If you have an idea, 如果有个主意

Thanks 谢谢

this: 这个:

channel 2: open failed: connect failed: Connection refused

your ssh tunnel's dynamic proxy doesn't look like it's working. 您的ssh隧道的动态代理看起来不起作用。 The failure looks unrelated to suds. 失败看起来与泡沫无关。 Some folks awhile back mentioned difficulties with openssh and hostnames, having success passing ip4 addresses to ssh instead. 一些人不久前提到了opensh和主机名的困难,而是成功地将ip4地址传递给ssh。 What does your ssh invocation look like? 您的ssh调用是什么样的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM