mirror of
				https://github.com/KevinMidboe/homeChecker.git
				synced 2025-10-29 17:40:26 +00:00 
			
		
		
		
	Added a script for quering server, should not be in project really. TODO: DELETE THIS
This commit is contained in:
		
							
								
								
									
										22
									
								
								homeCheck.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								homeCheck.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from socket import *
 | 
				
			||||||
 | 
					from pprint import pprint
 | 
				
			||||||
 | 
					import json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Set host name and port
 | 
				
			||||||
 | 
					host = '10.0.0.41'
 | 
				
			||||||
 | 
					port = 12001
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					clientSocket = socket(AF_INET, SOCK_DGRAM)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main():
 | 
				
			||||||
 | 
					    clientSocket.sendto(b'get_times', (host, port))
 | 
				
			||||||
 | 
					    message, address = clientSocket.recvfrom(1024)
 | 
				
			||||||
 | 
					    message = message.decode('utf-8')
 | 
				
			||||||
 | 
					    for item in json.loads(message):
 | 
				
			||||||
 | 
					        print(item['name'].ljust(10) + ': ' + item['time'])
 | 
				
			||||||
 | 
					    clientSocket.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					    main()
 | 
				
			||||||
		Reference in New Issue
	
	Block a user