From 6d4a34d9713458f3b2360066f650f0a4bedfe5e1 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 10 May 2019 06:57:15 -0700 Subject: [PATCH] Code cleanup (#921) --- src/gam.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gam.py b/src/gam.py index a566c295..19db537e 100755 --- a/src/gam.py +++ b/src/gam.py @@ -3567,8 +3567,7 @@ def doPrinterRegister(): #Get the printer first to make sure our OAuth access token is fresh callGAPI(cp.printers(), 'list') _, result = cp._http.request(uri='https://www.google.com/cloudprint/register', method='POST', body=body, headers=headers) - result = result.decode(UTF8) - result = json.loads(result) + result = json.loads(result.decode(UTF8)) checkCloudPrintResult(result) print('Created printer %s' % result['printers'][0]['id']) @@ -3620,11 +3619,8 @@ def doPrintJobSubmit(): #Get the printer first to make sure our OAuth access token is fresh callGAPI(cp.printers(), 'get', printerid=printer) _, result = cp._http.request(uri='https://www.google.com/cloudprint/submit', method='POST', body=body, headers=headers) - result = result.decode(UTF8) - result = json.loads(result) + result = json.loads(result.decode(UTF8)) checkCloudPrintResult(result) - if isinstance(result, str): - result = json.loads(result) print('Submitted print job %s' % result['job']['id']) def doDeletePrintJob():