Skip to main content

TP-Link Archer C50 API

HTTP based python package for API access and router management of the TP-Link Archer C50

Version 0.1.1

Dependencies

Usage

Initialize

Enter your hostname/IP & credentials used to log in to your router management page

import tplinkrouter  

router = tplinkrouter.C50('hostname','username','password')

Get

router._get('wlan')

# Return
{
    '[1,1,0,0,0,0]0': {'name': 'wlan0', 'SSID': 'myssid 2.4Ghz', 'enable': '1', 'X_TP_Configuration_Modified': '1', 'beaconType': '11i', 'standard': 'n', 'WEPEncryptionLevel': 'Disabled,40-bits,104-bits', 'WEPKeyIndex': '1', 'basicEncryptionModes': 'None', 'basicAuthenticationMode': 'None', 'WPAEncryptionModes': 'TKIPandAESEncryption', 'WPAAuthenticationMode': 'PSKAuthentication', 'IEEE11iEncryptionModes': 'AESEncryption', 'IEEE11iAuthenticationMode': 'PSKAuthentication', 'X_TP_PreSharedKey': 'password', 'X_TP_GroupKeyUpdateInterval': '0', 'X_TP_RadiusServerIP': '', 'X_TP_RadiusServerPort': '1812', 'X_TP_RadiusServerPassword': ''}, 
    '[1,2,0,0,0,0]0': {'name': 'wlan5', 'SSID': 'myssid 5Ghz', 'enable': '1', 'X_TP_Configuration_Modified': '0', 'beaconType': '11i', 'standard': 'ac', 'WEPEncryptionLevel': 'Disabled,40-bits,104-bits', 'WEPKeyIndex': '1', 'basicEncryptionModes': 'None', 'basicAuthenticationMode': 'None', 'WPAEncryptionModes': 'TKIPandAESEncryption', 'WPAAuthenticationMode': 'PSKAuthentication', 'IEEE11iEncryptionModes': 'AESEncryption', 'IEEE11iAuthenticationMode': 'PSKAuthentication', 'X_TP_PreSharedKey': 'password', 'X_TP_GroupKeyUpdateInterval': '0', 'X_TP_RadiusServerIP': '', 'X_TP_RadiusServerPort': '1812', 'X_TP_RadiusServerPassword': ''}
}
router._get('version')

# Return
{
     '[0,0,0,0,0,0]0': {
          'hardwareVersion': 'Archer C50 v1 00000002', 
          'softwareVersion': '0.9.1 3.0 v0045.0 Build 160411 Rel.42416n'
     }
}

Supported Parameters:

  • about
  • version
  • info
  • wan
  • wlan
  • 24ghz
  • 5ghz
  • dhcp_settings
  • dhcp_clients
  • restart
  • logout

Return Format: Dictionary

Set

Change Password of 2.4Ghz Network:

router._set('24ghz', [{'[LAN_WLAN#1,1,0,0,0,0#0,0,0,0,0,0]0,5': {'X_TP_PreSharedKey': 'new_password'}}])

Enable/Disable WAN PPPoE:

# Enable
router._set('wan', [{}, {'[WAN_PPP_CONN#1,1,1,0,0,0#0,0,0,0,0,0]1,19': {'enable': '1'}}, {}])

# Disable
router._set('wan', [{}, {'[WAN_PPP_CONN#1,1,1,0,0,0#0,0,0,0,0,0]1,19': {'enable': '0'}}])

Return Format: Boolean

Supported Parameters:

  • wan
  • 24ghz
  • 5ghz

_set() only updates the keys passed in argument 2. All other values are either fetched from the router wherever available.

Note 1: Value Format

All key/values passed in Argument 2 of _set() must be strings.
Argument 2 passed to _set() must be a List of Dictionaries.

Note 2: Positional Arguments

Each list item in Argument 2 of _set() directly corresponds to each subtask in the process.
Omitting an item in the list will ignore that subtask. (See Example: Disable WAN PPPoE, index[2] omitted)
To run a subtask without updating any of its values, pass an empty dictionary in its position.


Models

This has only been tested on the TP-Link Archer C50 V1 running firmware 160411.
Supported Models (known):

  • TP-Link Archer C50 V1
  • TP-Link N600

Error 500 & Login Limit

The TP-Link Web Interface only supports upto 1 user logged in at a time (for security reasons, apparently) which is the most common reason to recieve HTTP ERROR 500. As a workaround, you must log out from all other devices/browsers and try again. Additionally, you may also run router._get('logout')

Troubleshooting/Error Reporting/Contributing

  • If you face an error, you may debug using a HTTP Requests tool/monitor on your router's configuration webpage. Additionally, you may open a new issue on this repo prefixed by [Bug]
  • If you would like to help improve the package, request features or add support for more models, open an issue prefixed by [Feature Request] or [Improvement]

PRs and Commit Template

PRs and commits that you make to this repo must include the following:

  • Type: bug-fix or enhancement
  • Description: Brief description about what the commit achieves
  • Notes: (heads ups/pointers to other developers if necessary)

Changelog

v0.1.1

  • Remove AIOHTTP Dependency

v0.1.0

  • Python Package

Metadata

Release files for tplinkrouter-menahishayan 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tplinkrouter-menahishayan 0.1.0
File Size Uploaded
tplinkrouter-menahishayan-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tplinkrouter-menahishayan 0.1.0
File Interpreter ABI Platform
tplinkrouter_menahishayan-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / tplinkrouter-menahishayan-0.1.0.tar.gz

Download URL tplinkrouter-menahishayan-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
90749e374ebc85a073b0834177473f42d1b32ad3cff178c9aa28e6ba2bda3bb0
BLAKE2b-256 checksum
How to use checksums
c2a3881cf4d54f50c389e2db1008e05db50b9aabc8541ae215d5b613ca7ff498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release files / tplinkrouter_menahishayan-0.1.0-py3-none-any.whl

Download URL tplinkrouter_menahishayan-0.1.0-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c40bad95905ef0929369265abc6b69fc7564f37d4b098de241e3fb9b6097fb9
BLAKE2b-256 checksum
How to use checksums
f3432d5c6ad0779b644e14eb89c2edfaeede3ee5290a03c7508f4170b62c7ee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page