summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2015-08-18 23:38:05 +0200
committerChris Liechti <cliechti@gmx.net>2015-08-18 23:38:05 +0200
commit6c8887c4bf01caf38f7fed4cf03245520068909e (patch)
tree69de4dc3017619bcf57be0e7b7e11cf6c8af0a62
parentece60cf1434f095bfb5675bdf92a0aecb1093a3e (diff)
downloadpyserial-git-6c8887c4bf01caf38f7fed4cf03245520068909e.tar.gz
spy: remove debug print, add docs
-rw-r--r--serial/urlhandler/protocol_spy.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/serial/urlhandler/protocol_spy.py b/serial/urlhandler/protocol_spy.py
index f0e6270..06620ed 100644
--- a/serial/urlhandler/protocol_spy.py
+++ b/serial/urlhandler/protocol_spy.py
@@ -4,7 +4,9 @@
# see __init__.py
#
# This module implements a special URL handler that wraps an other port,
-# printint the traffic for debugging purposes
+# print the traffic for debugging purposes. With this, it is possible
+# to debug the serial port traffic on every application that uses
+# serial_for_url.
#
# (C) 2015 Chris Liechti <cliechti@gmx.net>
#
@@ -27,10 +29,6 @@ try:
import urlparse
except ImportError:
import urllib.parse as urlparse
-try:
- basestring
-except NameError:
- basestring = str # python 3
class Serial(serial.Serial):
"""Just inherit the native Serial port implementation and patch the port property."""
@@ -50,9 +48,8 @@ class Serial(serial.Serial):
def fromURL(self, url):
"""extract host and port from an URL string"""
- print(url)
parts = urlparse.urlsplit(url)
- if parts.scheme != "spy":
+ if parts.scheme != 'spy':
raise serial.SerialException('expected a string in the form "spy://port[?option[=value][&option[=value]]]": not starting with spy:// (%r)' % (parts.scheme,))
# process options now, directly altering self
for option, values in urlparse.parse_qs(parts.query, True).items():