Answer the question
In order to leave comments, you need to log in
Why does the proxy not work on the vds server?
When I run the code on my PC, the response arrives
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0'
}
def get_location(url):
response = requests.get(url=url, proxies={'https': 'proxi'})
soup = BeautifulSoup(response.text, 'lxml')
print(soup.find(class_='ip').text)
def main():
get_location(url='https://2ip.ru/')
if __name__ == '__main__':
main()
Answer the question
In order to leave comments, you need to log in
Firewall check for prohibiting rules. This applies to both the machine itself and the virtual network settings in the hoster panel (if any).
The hoster may have port restrictions for the VM. Check what is open and what is not
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question