#import urllib # #password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() # #top_level_url = "http://192.168.1.119" #password_mgr.add_password(None, top_level_url, "admin", "Azerty123") # #handler = urllib.request.HTTPBasicAuthHandler(password_mgr) # #opener = urllib.request.build_opener(handler) # #opener.open("http://192.168.1.119") # #urllib.request.install_opener(opener) # #temp = urllib.request.urlopen("http://192.168.1.119") from connections import * base_url = "http://192.168.1.215/" username = "admin" password = "Azerty123" data = { "ReplySuccessPage":"home.htm", "ReplyErrorPage":"home.htm", "WebLanguage":"4", "ConfigSystemLanguage":"Save" } #headers = { # "Host": "192.168.1.119", # "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0", # "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", # "Accept-Language": "en-US,en;q=0.5", # "Accept-Encoding": "gzip, deflate", # "Referer": "http://192.168.1.119/home.htm", # "Content-Type": "application/x-www-form-urlencoded", # "Content-Length": "87", # "Connection": "keep-alive", # "Upgrade-Insecure-Requests": "1" #} headers = [ ("Host","192.168.1.119"), ("User-Agent","Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0"), ("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Accept-Language","en-US,en;q=0.5"), ("Accept-Encoding","gzip, deflate"), ("Referer","http://192.168.1.119/home.htm"), ("Content-Type","application/x-www-form-urlencoded"), ("Content-Length","87"), ("Connection","keep-alive"), ("Upgrade-Insecure-Requests","1") ] posturl = "/home.thm" print("post request on setSystemLanguage:\n " + postReq("http://192.168.1.119"+posturl,username,password,data, headers)) #print("\n\n\n") #data = {"ReplySuccesPage":";ls","ReplyErrorPage":";ls"} #posturl = "" # #print("post request on index:\n "+postReq(base_url, username, password, data))