Compare commits
2 Commits
nilmdb-2.0
...
nilmdb-2.0
Author | SHA1 | Date | |
---|---|---|---|
a41111b045 | |||
85f822e1c4 |
@@ -109,7 +109,7 @@ class HTTPClient():
|
|||||||
stream=False, headers=headers)
|
stream=False, headers=headers)
|
||||||
if isjson:
|
if isjson:
|
||||||
return json.loads(response.content)
|
return json.loads(response.content)
|
||||||
return response.content
|
return response.text
|
||||||
|
|
||||||
def get(self, url, params=None):
|
def get(self, url, params=None):
|
||||||
"""Simple GET (parameters in URL)"""
|
"""Simple GET (parameters in URL)"""
|
||||||
|
@@ -6,6 +6,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import decorator
|
import decorator
|
||||||
import functools
|
import functools
|
||||||
|
import threading
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
@@ -178,6 +179,19 @@ def cherrypy_patch_exit():
|
|||||||
os._exit = real_exit
|
os._exit = real_exit
|
||||||
bus.exit = functools.partial(patched_exit, bus.exit)
|
bus.exit = functools.partial(patched_exit, bus.exit)
|
||||||
|
|
||||||
|
# A behavior change in Python 3.8 means that some thread exceptions,
|
||||||
|
# derived from SystemExit, now print tracebacks where they didn't
|
||||||
|
# used to: https://bugs.python.org/issue1230540
|
||||||
|
# Install a thread exception hook that ignores CherryPyExit;
|
||||||
|
# to make this match the behavior where we didn't set
|
||||||
|
# threading.excepthook, we also need to ignore SystemExit.
|
||||||
|
def hook(args):
|
||||||
|
if args.exc_type == CherryPyExit or args.exc_type == SystemExit:
|
||||||
|
return
|
||||||
|
sys.excepthook(args.exc_type, args.exc_value,
|
||||||
|
args.exc_traceback) # pragma: no cover
|
||||||
|
threading.excepthook = hook
|
||||||
|
|
||||||
|
|
||||||
# Start/stop CherryPy standalone server
|
# Start/stop CherryPy standalone server
|
||||||
def cherrypy_start(blocking=False, event=False):
|
def cherrypy_start(blocking=False, event=False):
|
||||||
|
@@ -26,7 +26,9 @@ class Timestamper():
|
|||||||
return b""
|
return b""
|
||||||
if line[0:1] == b'#':
|
if line[0:1] == b'#':
|
||||||
continue
|
continue
|
||||||
break
|
# For some reason, coverage on python 3.8 reports that
|
||||||
|
# we never hit this break, even though we definitely do.
|
||||||
|
break # pragma: no cover
|
||||||
try:
|
try:
|
||||||
return next(self.ts_iter) + line
|
return next(self.ts_iter) + line
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
|
Reference in New Issue
Block a user