简体   繁体   English

Python使用代理

[英]Python using proxies

Hi I am a newbie to Python. 嗨,我是Python的新手。 I was using googletrans and the admin suggested to use proxies in this form. 我正在使用googletrans,管理员建议以这种形式使用代理。 Can some explain the code below: 可以解释一下下面的代码:

from py_translator import Translator
proxy = {
        'http': 'http://username:password@1.1.1.1:1234',
        'https': 'http://username:password@1.1.1.1:1234',
}
s = Translator(proxies=proxy).translate(text='Hello my friend', dest='es').text
print(s)

You need to find a proxy for your own application. 您需要找到自己的应用程序的代理。 Then can you replace 'http://username:password@1.1.1.1:1234', with the username and password and IP provided by the proxy. 然后可以用代理提供的用户名,密码和IP替换'http://username:password@1.1.1.1:1234',

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

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