summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266
diff options
context:
space:
mode:
authorNoah Rosamilia <ivoahivoah@gmail.com>2016-05-07 14:59:02 -0400
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-05-07 22:45:08 +0300
commit2724bd4a94a3f75427bc2a287c88cbca69c49124 (patch)
tree39e229fb24fdf6708ff280e8e0f32e17002820ee /esp8266
parentcea1c621e0c05c9a90a693167fba9a4e8f42533a (diff)
downloadmicropython-2724bd4a94a3f75427bc2a287c88cbca69c49124.tar.gz
micropython-2724bd4a94a3f75427bc2a287c88cbca69c49124.zip
esp8266/scripts/webrepl: Add optional password argument to webrepl.start()
This commit fixes issue #2045
Diffstat (limited to 'esp8266')
-rw-r--r--esp8266/scripts/webrepl.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/esp8266/scripts/webrepl.py b/esp8266/scripts/webrepl.py
index 1a2c82277e..2239c2c0d6 100644
--- a/esp8266/scripts/webrepl.py
+++ b/esp8266/scripts/webrepl.py
@@ -49,14 +49,19 @@ def stop():
listen_s.close()
-def start(port=8266):
+def start(port=8266, password=None):
stop()
- try:
- import port_config
- _webrepl.password(port_config.WEBREPL_PASS)
+ if password is None:
+ try:
+ import port_config
+ _webrepl.password(port_config.WEBREPL_PASS)
+ setup_conn(port, accept_conn)
+ print("Started webrepl in normal mode")
+ except:
+ import webrepl_setup
+ setup_conn(port, webrepl_setup.handle_conn)
+ print("Started webrepl in setup mode")
+ else:
+ _webrepl.password(password)
setup_conn(port, accept_conn)
print("Started webrepl in normal mode")
- except:
- import webrepl_setup
- setup_conn(port, webrepl_setup.handle_conn)
- print("Started webrepl in setup mode")