# HG changeset patch # User Drew Perttula # Date 1559032934 0 # Node ID 87d9db21ba982e2cca775e824ae61da40e2b762c # Parent 9e6596b7f1a210a5ef497599e192e10a363bc979 treq content() deferred api fix Ignore-this: a2a3f8fa02cd7fe25a1ecb749ed8faf diff -r 9e6596b7f1a2 -r 87d9db21ba98 light9/vidref/musictime.py --- 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