【问题标题】:python WSDL.Proxy behind a http proxyhttp代理后面的python WSDL.Proxy
【发布时间】:2012-10-28 09:56:59
【问题描述】:

我有一个简单的代码,当我不在任何代理后面时它可以工作,但当我在代理后面时它不起作用。那么有什么方法可以指定必须通过WSDL.Proxy 类的构造函数中的http_proxy 建立连接?我一直在尝试ideone.py

【问题讨论】:

    标签: python wsdl http-proxy soappy


    【解决方案1】:

    您必须将以下补丁应用于ideone.py

    diff --git a/ideone.py b/ideone.py
    index fffdf27..b15abef 100644
    --- a/ideone.py
    +++ b/ideone.py
    @@ -42,10 +42,10 @@ def getError(response):
    
    
     class IdeOne:
    -    def __init__(self, user='test', password='test'):
    +    def __init__(self, user='test', password='test', **kwargs):
             self._user = user
             self._password = password
    -        self._wsdlObject = WSDL.Proxy('http://ideone.com/api/1/service.wsdl')
    +        self._wsdlObject = WSDL.Proxy('http://ideone.com/api/1/service.wsdl', **kwargs)
    
         def testFunction(self):
             response = self._wsdlObject.testFunction(self._user, self._password)
    

    这将允许将关键字参数传递给WSDL.Proxy,这将用于创建其内部Client.SOAPProxy 实例。 Client.SOAPProxy 有一个 http_proxy 关键字参数,因此,在应用补丁后,IdeOne(user='test', password='test', http_proxy='the.http.proxy') 应该可以工作。

    【讨论】:

      猜你喜欢
      • 2017-04-23
      • 2016-12-08
      • 1970-01-01
      • 2019-12-12
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-29
      相关资源
      最近更新 更多