Answer the question
In order to leave comments, you need to log in
Why don't proxies work in the program on a virtual machine?
They work on my machine, on a virtual machine I get errors:
'Cannot connect to proxy.', timeout('_ssl.c:1106: The handshake operation timed out')
# чек прокси
def check_proxy(self, proxies, headers):
global timeout
proxies = dict(https=proxies)
# url = 'https://api.ipify.org/'
url = 'https://api.vk.com/method/search.getHints'
params = dict(v=self.version)
try:
if headers != '':
res = requests.get(url, params, proxies=proxies, timeout=timeout, headers=headers)
else:
res = requests.get(url, params, proxies=proxies, timeout=timeout)
except Exception as e:
if 'Max retries' not in str(e) or 'Cannot connect to proxy' in str(e):
with open('error\ошибки с прокси.txt', mode='a', encoding='utf-8') as file:
file.write(str(datetime.today()) + '\n' + str(proxies) + '\n' + str(e) + '\n' + '\n')
return False
return True
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question