所以我想知道是否有可能从一个文件(带有代理)运行,并将其添加到我正在执行的每个线程的每个概要文件Json
。在这种情况下,如果我有ETC5配置文件,那么现在每个配置文件将得到一个每个线程:etc
def main():
log("Loaded # of profiles: " + Fore.CYAN + str(configLen) + Fore.RESET)
mylocale = config['event']['locale']
locale = 'en_%s' % mylocale
threads = []
for i in range(configLen):
t = threading.Thread(target=start, args=(str(i),locale,))
threads.append(t)
t.start()
不过,我试着加起来:
^{pr2}$但后来我意识到我需要做点什么
proxies = config['test']['profile_' + str(thread)]['proxy']
proxies = {
'https': 'https://' + proxies
}
实际上能够给代理工作,但我不确定这是否可能。你们有什么建议?也许这是可能的吗?在
编辑
proxies = {'http': "http://username:password@IP:PORT",
'https': "http://username:password@IP:PORT",
}
threads = []
for i in range(configLen):
t = threading.Thread(target=start, args=(str(i),locale,), proxies=proxies)
threads.append(t)
t.start()
我已经这样做了,但是它给了我一个错误说:
TypeError: init() got an unexpected keyword argument 'proxies'
您可以使用单独的方法来确定代理。这样,每个线程都可以调用该方法,并传递所有参数来确定代理。在
编辑
您可以将代理作为一个参数传递,并将其放在start可调用的内部。让我们有你写的代理:
您可以:
^{pr2}$所以你的
start
:应该行得通。在
相关问题 更多 >
编程相关推荐