messageboard-2022-09-12-1746.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









64556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495











                            <----SKIPPED LINES---->




  Returns:
    False if successful; error message string if failure occurs.
  """
  error_code = False

  data = str(StringToCharArray(s))
  headers = {
      'X-Vestaboard-Local-Api-Key': local_key,
      'Content-Type': 'application/x-www-form-urlencoded',
  }

  try:
    response = requests.post(
        local_address,
        headers=headers, data=data, timeout=timeout)
  except requests.exceptions.RequestException as e:
    error_msg = 'Unable to reach %s (%s): %s' % (local_address, response, e)
    Log(error_msg)
    error_code = True
  if not error_code:
    Log('Message sent to Vestaboard by way of local api')

  if update_dashboard:
    UpdateStatusLight(
        GPIO_ERROR_VESTABOARD_CONNECTION, error_code, error_msg)
  return error_code


def CurlTimingDetailsToString(curl):
  """Extracts timing details of a curl request into a readable string."""
  timing = {}
  timing['total-time'] = curl.getinfo(pycurl.TOTAL_TIME)
  timing['namelookup-time'] = curl.getinfo(pycurl.NAMELOOKUP_TIME)
  timing['connect-time'] = curl.getinfo(pycurl.CONNECT_TIME)
  timing['pretransfer-time'] = curl.getinfo(pycurl.PRETRANSFER_TIME)
  timing['redirect-time'] = curl.getinfo(pycurl.REDIRECT_TIME)
  timing['starttransfer-time'] = curl.getinfo(pycurl.STARTTRANSFER_TIME)
  results = [label + '=' + '%.4f' % timing[label] for label in timing]
  results = '; '.join(results)
  return results





                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









64556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495











                            <----SKIPPED LINES---->




  Returns:
    False if successful; error message string if failure occurs.
  """
  error_code = False

  data = str(StringToCharArray(s))
  headers = {
      'X-Vestaboard-Local-Api-Key': local_key,
      'Content-Type': 'application/x-www-form-urlencoded',
  }

  try:
    response = requests.post(
        local_address,
        headers=headers, data=data, timeout=timeout)
  except requests.exceptions.RequestException as e:
    error_msg = 'Unable to reach %s (%s): %s' % (local_address, response, e)
    Log(error_msg)
    error_code = True
  if not error_code:
    Log('Message sent to Vestaboard by way of local api: %s' % s)

  if update_dashboard:
    UpdateStatusLight(
        GPIO_ERROR_VESTABOARD_CONNECTION, error_code, error_msg)
  return error_code


def CurlTimingDetailsToString(curl):
  """Extracts timing details of a curl request into a readable string."""
  timing = {}
  timing['total-time'] = curl.getinfo(pycurl.TOTAL_TIME)
  timing['namelookup-time'] = curl.getinfo(pycurl.NAMELOOKUP_TIME)
  timing['connect-time'] = curl.getinfo(pycurl.CONNECT_TIME)
  timing['pretransfer-time'] = curl.getinfo(pycurl.PRETRANSFER_TIME)
  timing['redirect-time'] = curl.getinfo(pycurl.REDIRECT_TIME)
  timing['starttransfer-time'] = curl.getinfo(pycurl.STARTTRANSFER_TIME)
  results = [label + '=' + '%.4f' % timing[label] for label in timing]
  results = '; '.join(results)
  return results





                            <----SKIPPED LINES---->