def main(*argv):
    """ main driver of program """
    try:
        url = str(argv[0])

        arcgisSH = ArcGISTokenSecurityHandler()
        if arcgisSH.valid == False:
            arcpy.AddError(arcgisSH.message)
            return
        fl = FeatureLayer(
            url=url,
            securityHandler=arcgisSH,
            initialize=True)

        res = fl.query(where="1=1",out_fields='*',returnGeometry=False)
        arcpy.AddMessage(res)
        arcpy.SetParameterAsText(1, str(res))
    except arcpy.ExecuteError:
        line, filename, synerror = trace()
        arcpy.AddError("error on line: %s" % line)
        arcpy.AddError("error in file name: %s" % filename)
        arcpy.AddError("with error message: %s" % synerror)
        arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2))
    except FunctionError, f_e:
        messages = f_e.args[0]
        arcpy.AddError("error in function: %s" % messages["function"])
        arcpy.AddError("error on line: %s" % messages["line"])
        arcpy.AddError("error in file name: %s" % messages["filename"])
        arcpy.AddError("with error message: %s" % messages["synerror"])
        arcpy.AddError("ArcPy Error Message: %s" % messages["arc"])
    except:
        line, filename, synerror = trace()
        arcpy.AddError("error on line: %s" % line)
        arcpy.AddError("error in file name: %s" % filename)
        arcpy.AddError("with error message: %s" % synerror)
def main ( * argv ) : try : url = str ( argv [ 0 ] ) arcgisSH = ArcGISTokenSecurityHandler ( ) if arcgisSH . valid == False : arcpy . AddError ( arcgisSH . message ) return fl = FeatureLayer ( url = url , securityHandler = arcgisSH , initialize = True ) res = fl . query ( where = "1=1" , out_fields = '*' , returnGeometry = False ) arcpy . AddMessage ( res ) arcpy . SetParameterAsText ( 1 , str ( res ) ) except arcpy . ExecuteError : line , filename , synerror = trace ( ) arcpy . AddError ( "error on line: %s" % line ) arcpy . AddError ( "error in file name: %s" % filename ) arcpy . AddError ( "with error message: %s" % synerror ) arcpy . AddError ( "ArcPy Error Message: %s" % arcpy . GetMessages ( 2 ) ) except FunctionError , f_e : messages = f_e . args [ 0 ] arcpy . AddError ( "error in function: %s" % messages [ "function" ] ) arcpy . AddError ( "error on line: %s" % messages [ "line" ] ) arcpy . AddError ( "error in file name: %s" % messages [ "filename" ] ) arcpy . AddError ( "with error message: %s" % messages [ "synerror" ] ) arcpy . AddError ( "ArcPy Error Message: %s" % messages [ "arc" ] ) except : line , filename , synerror = trace ( ) arcpy . AddError ( "error on line: %s" % line ) arcpy . AddError ( "error in file name: %s" % filename ) arcpy . AddError ( "with error message: %s" % synerror )
main driver of program