Remove unused function
This commit is contained in:
@@ -31,27 +31,6 @@ def login(username, password, url='http://192.168.1.1', path='/ws'):
|
|||||||
def cookie(session_key, session_value, context_id):
|
def cookie(session_key, session_value, context_id):
|
||||||
return f'UILang=en; lastKnownIpv6TabState=visible; {session_key}/accept-language=en-US,en; {session_key}/sessid={session_value}; sah/contextId={context_id}'
|
return f'UILang=en; lastKnownIpv6TabState=visible; {session_key}/accept-language=en-US,en; {session_key}/sessid={session_value}; sah/contextId={context_id}'
|
||||||
|
|
||||||
def traceroute(username, password, url='http://192.168.1.1', path='/ws'):
|
|
||||||
session_key, session_value, context_id = login(username, password, url, path)
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'Accept': '*/*',
|
|
||||||
'Content-Type': 'application/x-sah-ws-4-call+json',
|
|
||||||
'Authorization': 'X-Sah ' + context_id,
|
|
||||||
'Cookie': cookie(session_key, session_value, context_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
data = {
|
|
||||||
'service': 'Traceroute',
|
|
||||||
'method': 'start_diagnostic',
|
|
||||||
'parameters': {
|
|
||||||
'host': 'www.google.com',
|
|
||||||
'ipversion': 'IPv4'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return post(url + path, headers=headers, data=dumps(data))
|
|
||||||
|
|
||||||
def reboot(username, password, url='http://192.168.1.1', path='/ws'):
|
def reboot(username, password, url='http://192.168.1.1', path='/ws'):
|
||||||
session_key, session_value, context_id = login(username, password, url, path)
|
session_key, session_value, context_id = login(username, password, url, path)
|
||||||
|
|
||||||
@@ -79,4 +58,3 @@ if __name__ == '__main__':
|
|||||||
path = environ.get('ROUTER_PATH') or '/ws'
|
path = environ.get('ROUTER_PATH') or '/ws'
|
||||||
|
|
||||||
reboot(username, password, url, path)
|
reboot(username, password, url, path)
|
||||||
|
|
Reference in New Issue
Block a user