无法使用代理设置连接到SOAP API

编程入门 行业动态 更新时间:2024-10-12 03:17:17
本文介绍了无法使用代理设置连接到SOAP API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用请求和zeep库使用SOAP API连接到服务器.如果手动设置Internet代理,则可以连接.但是,我打算在脚本中使用代理设置来自动执行该过程.我正在使用下面的代码块来做到这一点,但是下面却出现了错误.谁能帮助我在哪里出错?

I'm using requests and zeep library to connect to a server using SOAP API. If I manually set the internet proxy, I can connect. However, I intend to use proxy setting in my script to automate the process. I'm using the following block of code to do that, but I'm getting the error below. Can anyone pls help me where am I making the mistake?

ConnectionError: HTTPSConnectionPool(host ='xxxl',port = 443):最大值 网址超过重试次数:/webservice.php?wsdl(由 NewConnectionError(':无法建立新的连接: [WinError 10061]无法建立连接,因为目标 机器主动拒绝它",))

ConnectionError: HTTPSConnectionPool(host='xxxl', port=443): Max retries exceeded with url: /webservice.php?wsdl (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

from requests import Session from requests.auth import HTTPBasicAuth from zeep import Client from zeep.transports import Transport session = Session() session.proxies = {'http': 'abcdef:80'} session.auth = HTTPBasicAuth('username', 'passwd') client = Client('abcxyz/webservice.php?wsdl', transport=Transport(session=session))

推荐答案

使用代理身份验证来使用请求而不是会话身份验证来处理代理.用user:pass设置代理:

Use your proxy authentication to handle the proxy with requests, not the session auth. Set the proxies with user:pass:

proxies = { "http": "user:pass@your_proxy:port", "https": "user:pass@your_proxy:port", }

更多推荐

无法使用代理设置连接到SOAP API

本文发布于:2023-11-14 17:50:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588140.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   SOAP   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!