def safeReadJSON(url, logger, max_check=<NUM_LIT:6>, waittime=<NUM_LIT:30>):
counter = <NUM_LIT:0><EOL>while counter < max_check:<EOL><INDENT>try:<EOL><INDENT>with contextlib.closing(urllib.request.urlopen(url)) as f:<EOL><INDENT>res = json.loads(f.read().decode('<STR_LIT:utf8>'))<EOL><DEDENT>return res<EOL><DEDENT>except Exception as errmsg:<EOL><INDENT>logger.info('<STR_LIT>'.format(errmsg))<EOL><DEDENT>counter += <NUM_LIT:1><EOL>time.sleep(waittime)<EOL><DEDENT>logger.error('<STR_LIT>')<EOL>return None<EOL>
Return JSON object from URL