Samo Penic
2018-05-15 b1b8fc9f25fcff8bc145889abfaefe4ea48bf629
playground/tsclient.py
@@ -17,8 +17,8 @@
def get_ip():
   return ((([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")] or [[(s.connect(("8.8.8.8", 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) + ["no IP found"])[0])
def get_client_id(addr, my_ip, my_hostname):
   client_auth={'ip':my_ip,'hostname':my_hostname}
def get_client_id(addr, my_ip, my_hostname, subrun):
   client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun}
   response=requests.post(addr+"/api/register/", data=client_auth)
   if(response.status_code==200):
      client_data=json.loads(response.text)
@@ -138,7 +138,7 @@
   def run(self):
      while(not self.isStopped()):
         try:
            cid=get_client_id(self.conn_address, self.ip, self.hostname)
            cid=get_client_id(self.conn_address, self.ip, self.hostname, self.id)
         except:
            print("[{}] Could not get CID.".format(self.id))
            self.sleep(10)
@@ -314,6 +314,7 @@
   t=ClientThread(update_seconds=100)
   t.start()
   print("main")
   #t.join()
   #print("main")
   while(True):
      sleep(1000)