MCPcopy Index your code
hub / github.com/geekcomputers/Python / get_servers

Function get_servers

powerup_checks.py:81–95  ·  view source on GitHub ↗
(query)

Source from the content-addressed store, hash-verified

79
80
81def get_servers(query): # Function to get the servers from the database
82 conn = sqlite3.connect(master_db) # Connect to the database
83 cursor = conn.cursor() # Create the cursor
84 cursor.execute(
85 "select hostname from tp_servers where location =?", (query,)
86 ) # SQL Statement
87 print("\nDisplaying Servers for : " + query + "\n")
88 while True: # While there are results
89 row = cursor.fetchone() # Return the results
90 if row == None:
91 break
92 f = open(serverfile, "a") # Open the serverfile
93 f.write("%s\n" % str(row[0])) # Write the server out to the file
94 print(row[0]) # Display the server to the screen
95 f.close() # Close the file
96
97
98def main(): # Main Function

Callers 1

mainFunction · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected