spantaleev / roscraco

A library for managing home routers (networking equipment).
BSD 3-Clause "New" or "Revised" License
16 stars 10 forks source link

Adding TP-Link wr841n #2

Open laurfiac opened 8 years ago

laurfiac commented 8 years ago

I'm trying to adapt rosraco to automatically configure my router, the TL-WR841N, which seems quite similar to the TL-WR741N. I created new classes by copying router/tplink/wr740n.py and router/tplink/wr741n.py.

I ran the following commands in the python console:

import roscraco controller = roscraco.create_controller(roscraco.ROUTER_TP_LINK, 'WR841N', '192.168.0.1', 80, 'admin', 'admin') roscraco.helper.print_info(controller)

And I got the following error:

Traceback (most recent call last): File "", line 1, in File "roscraco/helper/init.py", line 7, in print_info router_info = router_obj.get_router_info() File "roscraco/router/tplink/base.py", line 40, in get_router_info return _parse_router_info(self._get_status_array('statusPara')) File "roscraco/router/tplink/base.py", line 36, in _get_status_array return _extract_js_array_data(contents, array_name) File "roscraco/router/tplink/base.py", line 159, in _extract_js_array_data raise RouterParseError('Failed at evaluating array %s: %s' % (array_name, repr(e))) roscraco.exception.RouterParseError: Failed at evaluating array statusPara: ValueError('substring not found',)

I printed the variable contents in the function _get_status_array in the file router/tplink/base.py. The output I got corresponds to the login page of the router's interface.

I tried to understand when and how the login and password are sent to the router. I understand that an "Authorization" string is build by _prepare_base64_auth_string in TplinkBase._perform_http_request. It's then added to req and sent by requestor.urlopen in RouterBase._perform_http_request.

Did I do something wrong ? Are the two routers different ? I haven't any clue on how to continue debugging. Can you give me some pointers ?

ovt00 commented 7 years ago

Hello. That problem fixed?