Answer the question
In order to leave comments, you need to log in
Problem with proxy in python, how to fix?
My code:
proxy_list = []
with open("proxy.txt") as inp:
for line in inp:
proxy_list.append(line)
for prx in proxy_list:
print(prx)
ses.proxies = prx
ses.get("https://2ip.ru")
soup = BeautifulSoup(r.text, 'lxml')
prx = soup.find('div', {'class' : 'ip'})
Answer the question
In order to leave comments, you need to log in
Proxies must be loaded in a different format
https://docs.python-requests.org/en/latest/user/ad...
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
ses.proxies = prx
Plural - "proxies"... Maybe he wants a list of proxies and will look for the first worker?
EDIT: no, he needs a dictionary of proxies for different protocols .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question