From 469163b312a63d8e64e1d3200f1c299c770a6697 Mon Sep 17 00:00:00 2001 From: worldofvarun Date: Fri, 22 Dec 2023 18:38:38 +0530 Subject: [PATCH] Fixed: error by adding new methods("httpclient.html") for Wi-Fi login/logout functionality --- .idea/.gitignore | 8 ++++++++ .idea/misc.xml | 9 +++++++++ .idea/modules.xml | 8 ++++++++ .idea/puwifi.iml | 11 +++++++++++ .idea/vcs.xml | 6 ++++++ src/puwifi.py | 8 +++++--- 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/puwifi.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3fae023 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..68956b8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/puwifi.iml b/.idea/puwifi.iml new file mode 100644 index 0000000..2cdb1e3 --- /dev/null +++ b/.idea/puwifi.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/puwifi.py b/src/puwifi.py index feb6b53..0e06062 100644 --- a/src/puwifi.py +++ b/src/puwifi.py @@ -49,6 +49,8 @@ class WifiUtils: """class for wifi utils""" + method_login = method_logout = "httpclient.html" + def __init__(self): pass @@ -78,7 +80,7 @@ def pw_request(self, response(xml data returned form server) status_code(web request status code) """ - url = "http://"+host+":"+port+"/"+method + url = f"http://{host}:{port}/{method}" logging.info(url) body_arg_passwd = f"&password={password}" if mode == "191" else "" @@ -130,7 +132,7 @@ def login(self, password, host, port="8090", - method="login.xml", + method=method_login, timeout=10) -> list: """login: uses request method to send login web request with credentials to wifi host @@ -151,7 +153,7 @@ def logout(self, username, host, port="8090", - method="logout.xml", + method=method_logout, timeout=10) -> list: """logout: uses request method to send logout web request with credentials to wifi host