Fix quotes - standardize to single-quoted strings

This commit is contained in:
Labrys of Knossos 2018-12-29 14:05:37 -05:00
commit c5343889fb
30 changed files with 1257 additions and 1257 deletions

View file

@ -31,32 +31,32 @@ def command_complete(url, params, headers, section):
try:
r = requests.get(url, params=params, headers=headers, stream=True, verify=False, timeout=(30, 60))
except requests.ConnectionError:
logger.error("Unable to open URL: {0}".format(url), section)
logger.error('Unable to open URL: {0}'.format(url), section)
return None
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status {0}".format(r.status_code), section)
logger.error('Server returned status {0}'.format(r.status_code), section)
return None
else:
try:
return r.json()['state']
except (ValueError, KeyError):
# ValueError catches simplejson's JSONDecodeError and json's ValueError
logger.error("{0} did not return expected json data.".format(section), section)
logger.error('{0} did not return expected json data.'.format(section), section)
return None
def completed_download_handling(url2, headers, section="MAIN"):
def completed_download_handling(url2, headers, section='MAIN'):
try:
r = requests.get(url2, params={}, headers=headers, stream=True, verify=False, timeout=(30, 60))
except requests.ConnectionError:
logger.error("Unable to open URL: {0}".format(url2), section)
logger.error('Unable to open URL: {0}'.format(url2), section)
return False
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status {0}".format(r.status_code), section)
logger.error('Server returned status {0}'.format(r.status_code), section)
return False
else:
try:
return r.json().get("enableCompletedDownloadHandling", False)
return r.json().get('enableCompletedDownloadHandling', False)
except ValueError:
# ValueError catches simplejson's JSONDecodeError and json's ValueError
return False