示例#1
0
def getUsers():
    s = shift_planning.ShiftPlanning(creds.HUMANITY_KEY, creds.HUMANITY_LOGIN, creds.HUMANITY_PASSWORD)
    s.do_login()
    s.get_employees()
    uf = UserFactory('users.csv')
    for e in s.get_public_data():
        firstname = e["firstname"]
        lastname = e["lastname"]
        if firstname is None:
            firstname = ""
        if lastname is None:
            lastname = ""
        else:
            lastname = lastname + ", "
        uf.write(e['id'], e['firstname'], e['lastname'], e['username'], 0)
示例#2
0
def clockOutUser(userid):
    s = shift_planning.ShiftPlanning(creds.HUMANITY_KEY, creds.HUMANITY_LOGIN, creds.HUMANITY_PASSWORD)
    s.do_login()
    s.terminal_clockout(creds.TERMINAL_KEY, creds.COMPUTER_ID, str(userid))
示例#3
0
def clockInUser(userid):
    s = shift_planning.ShiftPlanning(creds.HUMANITY_KEY, creds.HUMANITY_LOGIN, creds.HUMANITY_PASSWORD)
    s.do_login()
    s.timeclock_terminals()
    #print s.get_public_data()
    s.terminal_clockin(creds.TERMINAL_KEY, creds.COMPUTER_ID, str(userid))
示例#4
0
def getUserStatus(userid, details):
    s = shift_planning.ShiftPlanning(creds.HUMANITY_KEY, creds.HUMANITY_LOGIN, creds.HUMANITY_PASSWORD)
    s.do_login()
    s.get_timeclock_status(str(userid), details)
    return s.get_public_data()
示例#5
0
def getUserDetails(userid):
    s = shift_planning.ShiftPlanning(creds.HUMANITY_KEY, creds.HUMANITY_LOGIN, creds.HUMANITY_PASSWORD)
    s.do_login()
    s.get_employee_details(str(userid))
#    print s.get_public_data()
    return s.get_public_data()
#!/usr/bin/env python
import os
import shift_planning
  
    
def say_hello():
    print 'hi'
    
if __name__ == "__main__":
    key = "your token goes here"
    username = '******'
    pwd = 'password'
    s = shift_planning.ShiftPlanning(key,username,pwd)
    s.set_callback(say_hello)
    s.do_login()
    #file upload test: make sure you've a test1.pdf in this directory
    file_path = os.path.normpath('test1.pdf')
    s.create_admin_file(file_path)
    creating and message
    s.create_message({'message':'this is a beautiful day.','subject':'weather','to':'14320'})
    s.get_messages()
    print s.get_public_data()
    #creating a wall message
    s.create_wall_message({'title':'fun weather','post':'cool weather'})
    s.get_wall_messages()
    print s.get_public_data()
    #creating an employee
    s.create_employee({'name':'Paul'})
    s.get_employees()
    print s.get_public_data()
    s.get_employee_details('14304')