Z
Z
zeng1242022-02-22 07:46:47
Python
zeng124, 2022-02-22 07:46:47

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()

and when I uploaded this code to the vds server and tried to run it, the answer did not come. And there was an error that timeout is exceeded. And without a proxy, everything is fine
Ubuntu 20.04 costs both on vds and on my PC

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2022-02-22
@karabanov

Firewall check for prohibiting rules. This applies to both the machine itself and the virtual network settings in the hoster panel (if any).

N
Nikolai Savelyev, 2022-02-22
@AgentSmith

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 question

Ask a Question

731 491 924 answers to any question