简体   繁体   English

python simple_salesforce代理用法

[英]python simple_salesforce proxy usage

I'm using python simple_salesforce module from this example: https://pypi.python.org/pypi/simple-salesforce . 我正在从以下示例中使用python simple_salesforce模块: https : //pypi.python.org/pypi/simple-salesforce Specifically: 特别:

proxies = { "http": "http://10.10.1.10:3128" } from simple_salesforce import Salesforce sf = Salesforce(username='myemail@example.com.sandbox', password='password', security_token='token', sandbox=True, proxies=proxies) proxies = { "http": "http://10.10.1.10:3128" } from simple_salesforce import Salesforce sf = Salesforce(username='myemail@example.com.sandbox', password='password', security_token='token', sandbox=True, proxies=proxies)

Its failing with the below error. 其失败并显示以下错误。 requests.exceptions.ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))

If I dont use proxy, it works fine. 如果我不使用代理,它会正常工作。 My requirement is to enable proxy. 我的要求是启用代理。 Any suggestions? 有什么建议么?

Adding the following to the beginning of the program will solve this problem. 在程序的开头添加以下内容将解决此问题。 I was using urllib2 in python and that takes care of forwarding the request through proxy. 我在python中使用urllib2,它负责通过代理转发请求。 For the answer to my question: 对于我的问题的答案:

If your hostname and port for proxy are xyz1-pqr01.abc.company.com and 3128 then import os os.environ['http_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128' os.environ['https_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128' 如果代理的主机名和端口是xyz1-pqr01.abc.company.com和3128,则import os os.environ['http_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128' os.environ['https_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128' //xyz1-pqr01.abc.company.com:3128'os import os os.environ['http_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128' os.environ['https_proxy'] = 'http://xyz1-pqr01.abc.company.com:3128'

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

相关问题 python simple_salesforce查询全部 - python simple_salesforce query all 使用python和simple_salesforce将文件上传到salesforce为空 - File uploaded to salesforce empty using python and simple_salesforce 找不到simple_salesforce方法 - simple_salesforce method not found ModuleNotFoundError:没有名为“simple_salesforce”的模块 - ModuleNotFoundError: No module named 'simple_salesforce' simple-salesforce 和 simple_salesforce 有什么区别? - What is the difference between simple-salesforce and simple_salesforce? simple_salesforce Feed 项目 @mention 问题 - simple_salesforce Feed Item @mention problem Python import simple_salesforce 在 Databricks 中给出:没有名为 cryptography.hazmat.primitives.asymmetric.ed25519 的模块 - Python import simple_salesforce in Databricks gives: No module named cryptography.hazmat.primitives.asymmetric.ed25519 读取超时。 (读取超时=无)通过 simple_salesforce API 在 Python 中插入记录时 - Read timed out. (read timeout=None) when inserting records through simple_salesforce API in Python simple_salesforce python中的父子关系查询,从有序字典中提取 - parent-child relationship query in simple_salesforce python, extracting from ordered dicts simple_salesforce python:sf.instance.bulk.query 给出索引错误 - simple_salesforce python : sf.instance.bulk.query gives index error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM