Sometimes we need to use proxy server for boring stuff (never mind!),thus in this scenario we can change the gnome's network settings just using a script or we can write bash script(i'm so lazy so Didn't wrote ). In this whole process...
Calling the subprocess will execute terminal command.
import os
import subprocess
def change_network():
change_to_manual = subprocess.call([ "gsettings", "set", "org.gnome.system.proxy", "mode", "'manual'"])
change_https = subprocess.call(["gsettings", "set", "org.gnome.system.proxy.https", "host", "'172.0.0.1'"])
change_port = subprocess.call(["gsettings", "set", "org.gnome.system.proxy.https", "port", "8888"])
change_http = subprocess.call(["gsettings", "set", "org.gnome.system.proxy.http" ,"host" ,"'172.0.0.1'"])
change_port = subprocess.call(["gsettings", "set", "org.gnome.system.proxy.http" ,"port" ,"8888"])
if __name__==__main__:
change_network()
Walah!!! We have changed network settings.
☺ happy coding!
Top comments (0)