Code cleanup (#921)

This commit is contained in:
Ross Scroggs
2019-05-10 06:57:15 -07:00
committed by Jay Lee
parent 43b17cce0e
commit 6d4a34d971

View File

@@ -3567,8 +3567,7 @@ def doPrinterRegister():
#Get the printer first to make sure our OAuth access token is fresh #Get the printer first to make sure our OAuth access token is fresh
callGAPI(cp.printers(), 'list') callGAPI(cp.printers(), 'list')
_, result = cp._http.request(uri='https://www.google.com/cloudprint/register', method='POST', body=body, headers=headers) _, 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.decode(UTF8))
result = json.loads(result)
checkCloudPrintResult(result) checkCloudPrintResult(result)
print('Created printer %s' % result['printers'][0]['id']) 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 #Get the printer first to make sure our OAuth access token is fresh
callGAPI(cp.printers(), 'get', printerid=printer) callGAPI(cp.printers(), 'get', printerid=printer)
_, result = cp._http.request(uri='https://www.google.com/cloudprint/submit', method='POST', body=body, headers=headers) _, 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.decode(UTF8))
result = json.loads(result)
checkCloudPrintResult(result) checkCloudPrintResult(result)
if isinstance(result, str):
result = json.loads(result)
print('Submitted print job %s' % result['job']['id']) print('Submitted print job %s' % result['job']['id'])
def doDeletePrintJob(): def doDeletePrintJob():