changeset 1889:87d9db21ba98

treq content() deferred api fix Ignore-this: a2a3f8fa02cd7fe25a1ecb749ed8faf
author Drew Perttula <drewp@bigasterisk.com>
date Tue, 28 May 2019 08:42:14 +0000
parents 9e6596b7f1a2
children ff15b27b640c
files light9/vidref/musictime.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/light9/vidref/musictime.py	Tue May 28 08:41:47 2019 +0000
+++ b/light9/vidref/musictime.py	Tue May 28 08:42:14 2019 +0000
@@ -2,6 +2,7 @@
 from typing import Dict
 
 from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks
 import treq
 
 from light9 import networking
@@ -61,12 +62,13 @@
 
     def pollMusicTime(self):
 
+        @inlineCallbacks
         def cb(response):
 
             if response.code != 200:
-                raise ValueError("%s %s", response.code, response.body)
+                raise ValueError("%s %s", response.code, (yield response.content()))
 
-            position = json.loads(response.body)
+            position = yield response.json()
 
             # this is meant to be the time when the server gave me its
             # report, and I don't know if that's closer to the