original_docstring: The main function of this module.
docstring: The main function of this module.
docstring_tokens: The main function of this module .
code: def main():
      """The main function of this module."""
      parser = argparse.ArgumentParser(description='Extract lunch restaurant menus.')
      parser.add_argument('config', type=str, help='restaurant configuration file')
  
      args = parser.parse_args()
  
      try:
          with open(args.config, 'r') as conf_file:
              config = json.load(conf_file)
          all_menus = get_menus(config['restaurants'])
      except FileNotFoundError:
          print('Could not find configuration file: {}'.format(args.config))
          exit(1)
  
      resp = requests.post(config['backendUrl'], json=all_menus, timeout=5)
      timestamp = datetime.now().isoformat()
      if not resp.ok:
          print('{0}: Menu extraction failed, HTTP status code: {1}'.format(timestamp,
                                                                            str(resp.status_code)))
      else:
          status = resp.json()
          if status['status'] == 'success':
              print('{}: Menu extraction succeeded'.format(timestamp))
          else:
              print('{}: Menu extraction failed, error: {}. See server log for more details.'.
                    format(timestamp, status['cause']))
code_tokens: def main ( ) : parser = argparse . ArgumentParser ( description = 'Extract lunch restaurant menus.' ) parser . add_argument ( 'config' , type = str , help = 'restaurant configuration file' ) args = parser . parse_args ( ) try : with open ( args . config , 'r' ) as conf_file : config = json . load ( conf_file ) all_menus = get_menus ( config [ 'restaurants' ] ) except FileNotFoundError : print ( 'Could not find configuration file: {}' . format ( args . config ) ) exit ( 1 ) resp = requests . post ( config [ 'backendUrl' ] , json = all_menus , timeout = 5 ) timestamp = datetime . now ( ) . isoformat ( ) if not resp . ok : print ( '{0}: Menu extraction failed, HTTP status code: {1}' . format ( timestamp , str ( resp . status_code ) ) ) else : status = resp . json ( ) if status [ 'status' ] == 'success' : print ( '{}: Menu extraction succeeded' . format ( timestamp ) ) else : print ( '{}: Menu extraction failed, error: {}. See server log for more details.' . format ( timestamp , status [ 'cause' ] ) )
short_docstring: The main function of this module.
short_docstring_tokens: The main function of this module .
comment: """The main function of this module."""