0

I have long time seeking for a solution to set a proxy for my Django application.

1st I am using Django==2.0 and I run it in Windows Server 2016 in a local network that uses a Proxy to connect 10.37.235.99 and Port 80. and I'm deploying the application using nginx-1.20.1

I have to scrape a data as

    http_proxy  = "10.37.235.99:80"
    https_proxy = "10.37.235.99:80"
    ftp_proxy   = "10.37.235.99:80"

    proxyDict = { 
                  "http"  : http_proxy, 
                  "https" : https_proxy, 
                  "ftp"   : ftp_proxy
                }
    import socket
    if socket.gethostname() == "localhost":
        os.environ["PROXIES"] = proxyDict
    else:
        os.environ["PROXIES"] = {}
    URL='my_site.com'
    page = requests.get(URL)
    print(page)

I tried many solutions on the internet but no way! Working with django : Proxy setup

when I remove the proxy configuration and I use Psiphon3(with proxy) everything works perfectly.

is there any solution?

tibas
  • 109
  • 8

0 Answers0