Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime, timedelta
- import requests
- import os
- print(1)
- #Login API to get the token
- reqLogin = requests.post('http://139.162.29.201:3001/auth/sign_in', json = {'email': 'aa', 'password': 'aa'})
- reqLogin = reqLogin.json()
- print(2)
- #Get all the clients
- reqClient = requests.request('GET', 'http://139.162.29.201:3001/clients', headers = {'Authorization': 'JWT '+ reqLogin['token']})
- reqClient = reqClient.json()
- print(3)
- #Initialize time
- #time = (datetime.now() + timedelta(hours = 5, minutes = 30)).strftime('%H:%M:%S')
- time = "05:59:50"
- timeInSecondsList = time.split(":")
- time = timedelta(hours = int(timeInSecondsList[0]), minutes = int(timeInSecondsList[1]))
- print(4)
- #Initialize date
- dateTime = (datetime.now() + timedelta(hours = 5, minutes = 30)).strftime('%Y-%m-%d')
- dateTimeYesterday = (datetime.now() + timedelta(days = -1, hours = 5, minutes = 30)).strftime('%Y-%m-%d')
- print(5)
- for eachClient in reqClient:
- #Get the shift timing against the client
- reqShiftTiming = requests.post('http://139.162.29.201:3001/getShiftTiming', headers = {'Authorization': 'JWT '+reqLogin['token']}, json = {'clientId': eachClient['clientId']})
- reqShiftTiming = reqShiftTiming.json()
- print(6)
- shiftAList = reqShiftTiming[0]['shiftA'].split(":")
- shiftBList = reqShiftTiming[0]['shiftB'].split(":")
- shiftCList = reqShiftTiming[0]['shiftC'].split(":")
- print(7)
- if time == timedelta(hours = int(shiftBList[0]), minutes = int(shiftBList[1]) - 1):
- print(8)
- file = 'python /quad/finalMachineEfficiency.py '+ eachClient['clientId'] + ' ' + timeInSecondsList[0] + ':' + timeInSecondsList[1] + ' ' + dateTime
- os.system(file)
- print(os.system(file))
- if time == timedelta(hours = int(shiftCList[0]), minutes = int(shiftCList[1]) - 1):
- print(9)
- file = 'python /quad/finalMachineEfficiency.py '+ eachClient['clientId'] + ' ' + timeInSecondsList[0] + ':' + timeInSecondsList[1] + ' ' + dateTime
- os.system(file)
- print(os.system(file))
- if time == timedelta(hours = int(shiftAList[0]), minutes = int(shiftAList[1]) - 1):
- print(10)
- file = 'python /quad/finalMachineEfficiency.py '+ eachClient['clientId'] + ' ' + timeInSecondsList[0] + ':' + timeInSecondsList[1] + ' ' + dateTimeYesterday
- os.system(file)
- file2 = 'python /quad/finalOee.py ' + eachClient['clientId'] + ' ' + timeInSecondsList[0] + ':' + timeInSecondsList[1] + ' ' + dateTimeYesterday
- os.system(file2)
- print(os.system(file), os.system(file2))
- print("callefficiency.py ended", dateTime)
- callefficiency.py started
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 10
- 256 256
- 6
- 7
- 10
- 256 256
- 6
- 7
- 10
- 256 256
- 6
- 7
- 10
- 256 256
- callefficiency.py ended 2017-12-15
Add Comment
Please, Sign In to add comment