Giter Site home page Giter Site logo

auto-clock's Introduction

Auto clock in/out on NCU HumanSys

Dependency

  • Python3
  • requests
  • lxml

Usage

usage: python3 clock.py [-h] [--config CONFIG] [-j JOBNAME] {signin,signout}

positional arguments:
  {signin,signout}

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       default: config.json
  -j JOBNAME, --jobname JOBNAME
                        欲打卡工作名稱,定義在 config.json (default: default_job)

How to Use

  1. Make sure you have installed the dependencies.

      $ pip3 install requests lxml
    
  2. Create config.json

      $ cp config.json.example config.json
    
  3. Config.json format example

{
 "account": "",
 "password": "",
 "jobs":
 {
    "default_job":
     {
         "partTimeId": "Get from the url of the page you clock in/out",
         "attendWork": "值班"
     },
     "example_job1":
     {
         "partTimeId": "111999",
         "attendWork": "值班 & 開發"
     },
     "example_job2":
     {
         "partTimeId": "119999",
         "attendWork": ""
     }
 }
}
  1. Set these parameters in config.json

    Parameters description
    account Account on Portal
    password Password on Portal
    jobs Jobs list, jobName => partTimeId and attendWork
    partTimeId Get from the url of the page you clock in/out
    attendWork Job content
  2. Set the script executable.

        $ sudo chmod 777 Auto_clock/clock.py
    
  3. Time calibration.

  4. Config the crontab.

      $ crontab -e
    
      #   minute   hour  day   month dayofweek  COMMAND
         0        8     1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py signin 
         2        18    1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py signout
    
         0        8     1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py -j example_job1 signin 
         2        18    1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py -j example_job1 signout
    
         0        8     1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py -j example_job2 signin 
         2        18    1-7   *     *           python3 /PATH/TO/Auto_clock/clock.py -j example_job2 signout        
      # For example, 50 hours per month per jobs.    
    

auto-clock's People

Contributors

youngle37 avatar hope51607 avatar 0522andrew avatar wangpeisyuan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.