fix time check of timenet api when need sleep after web request.
Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
@@ -58,7 +58,6 @@ class timenetManager:
|
||||
return self.get('check/info', {"guid": args.user})
|
||||
|
||||
def sendUpdate(self):
|
||||
self.updateTime()
|
||||
|
||||
if args.pin is None:
|
||||
# if pin is None, prompt for it
|
||||
@@ -87,22 +86,24 @@ class timenetManager:
|
||||
else:
|
||||
typ = args.type
|
||||
|
||||
data = {
|
||||
"cp": config['user'],
|
||||
"pin": args.pin,
|
||||
"typ": typ,
|
||||
"date": self.headers['tn-d'],
|
||||
"geoLatitude": config['geo']['latitude'],
|
||||
"geoLongitude": config['geo']['longitude'],
|
||||
"geoError": "",
|
||||
"c": 1,
|
||||
"geoAccuracy": config['geo']['accuracy']
|
||||
}
|
||||
|
||||
|
||||
response = None
|
||||
if not args.debug:
|
||||
self.addMessage("####HACIENDO CHECK####")
|
||||
sleep(random.randint(80, 230))
|
||||
sleep(random.randint(0, 230))
|
||||
self.updateTime()
|
||||
data = {
|
||||
"cp": config['user'],
|
||||
"pin": args.pin,
|
||||
"typ": typ,
|
||||
"date": self.headers['tn-d'],
|
||||
"geoLatitude": config['geo']['latitude'],
|
||||
"geoLongitude": config['geo']['longitude'],
|
||||
"geoError": "",
|
||||
"c": 1,
|
||||
"geoAccuracy": config['geo']['accuracy']
|
||||
}
|
||||
response = self.post("check", data, self.headers)
|
||||
else:
|
||||
self.addMessage('Corriendo en modo debug. No se realizará ninguna acción')
|
||||
|
||||
Reference in New Issue
Block a user