set proxy to windows with os library using python

Viewed 377

I'm setting up a python script which get proxy from user and connect windows to that proxy. I used os lib to execute command prompt command to connect to the proxy:

import os
os.system('netsh winhttp set proxy {0}:{1}'.format('89.42.198.79', '47570'))

when I run this script I get this output:

Current WinHTTP proxy settings:

    Proxy Server(s) :  89.42.198.79:47570
    Bypass List     :  (none)

and when I check my proxy status using this command :

netsh winhttp show proxy    

it says that proxy set correctly, But when I check my IP or when I check my proxy setting in windows, nothing changed, I wonder what is my problem and why netsh winhttp set proxy doesn't work properly?

0 Answers
Related