Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrErohin committed Oct 31, 2024
1 parent ccf0ebb commit 8f541b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ router = TplinkRouterProvider.get_client('http://192.168.0.1', 'password')
# router = TplinkRouter('http://192.168.0.1', 'password')
# You may also pass username if it is different and a logger to log errors as
# router = TplinkRouter('http://192.168.0.1','password','admin2', Logger('test'))
# If you have the TP-link C1200 V2 or similar, you can use the TplinkC1200Router class instead of the TplinkRouter class.
# Remember that the password for this router is different, here you need to use the web encrypted password.
# To get web encrypted password, read Web Encrypted Password section
# router = TplinkC1200Router('http://192.168.0.1','WebEncryptedPassword', Logger('test'))

try:
router.authorize() # authorizing
Expand Down Expand Up @@ -64,16 +60,6 @@ finally:
The TP-Link Web Interface only supports upto 1 user logged in at a time (for security reasons, apparently).
So before action you need to authorize and after logout

### <a id="encrypted_pass">Web Encrypted Password</a>
If you got exception - `You need to use web encrypted password instead. Check the documentation!`
or you have TP-link C1200 V2 or similar router you need to get web encrypted password by these actions:
1. Go to the login page of your router. (default: 192.168.0.1).
2. Type in the password you use to login into the password field.
3. Click somewhere else on the page so that the password field is not selected anymore.
4. Open the JavaScript console of your browser (usually by pressing F12 and then clicking on "Console").
5. Type `document.getElementById("login-password").value;`
6. Copy the returned value as password and use it.

## Functions
| Function | Args | Description | Return |
|---|---|---|---|
Expand Down Expand Up @@ -224,8 +210,8 @@ or you have TP-link C1200 V2 or similar router you need to get web encrypted pas
- Archer AX11000 V1
- Archer BE800 v1.0
- Archer BE805 v1.0
- Archer C1200 (v1.0, v2.0) (You need to use [web encrypted password](#encrypted_pass))
- Archer C2300 v1.0 (You need to use [web encrypted password](#encrypted_pass))
- Archer C1200 (v1.0, v2.0)
- Archer C2300 v1.0
- Archer C6 (v2.0, v3.0)
- Archer C6U v1.0
- Archer C7 (v4.0, v5.0)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="tplinkrouterc6u",
version="4.2.3",
version="5.0.0",
author="Alex Erohin",
author_email="[email protected]",
description="TP-Link Router API",
Expand Down
9 changes: 6 additions & 3 deletions tplinkrouterc6u/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def authorize(self) -> None:
self._logged = True

except Exception as e:
error = ("TplinkRouter - {} - Cannot authorize! Error - {}; Response - {}"
error = ("TplinkRouter - C1200 - {} - Cannot authorize! Error - {}; Response - {}"
.format(self.__class__.__name__, e, data))
if self._logger:
self._logger.error(error)
Expand All @@ -752,7 +752,7 @@ def _request_pwd(self) -> None:
self._pwdEE = args[1]

except Exception as e:
error = ('TplinkRouter - {} - Unknown error for pwd! Error - {}; Response - {}'
error = ('TplinkRouter - C1200 - {} - Unknown error for pwd! Error - {}; Response - {}'
.format(self.__class__.__name__, e, response.text))
if self._logger:
self._logger.error(error)
Expand Down Expand Up @@ -1404,4 +1404,7 @@ def get_client(host: str, password: str, username: str = 'admin', logger: Logger
if router.supports():
return router

return None
raise ClientException(('Your router is not supported. Please add your router support to '
'https://github.com/AlexandrErohin/TP-Link-Archer-C6U'
'by implementing methods for AbstractRouter class'
))

0 comments on commit 8f541b4

Please sign in to comment.