Coder Social home page Coder Social logo

clockin's Introduction

Swjtu 网上健康信息定时填报脚本

已跟随信息填报系统更新并完成测试

  • 支持 win 与 linux 建议通过tmux运行在VPS服务器上

  • 安装依赖

    pip install -r requirements.txt
    
  • 创建config.json文件

    内容参考 config_template.json 与 config_demo.json
    
  • linux下需安装chrome

    • 打开一个终端,使用下面的命令编辑sources.list源文件

      sudo nano /etc/apt/sources.list
      
    • 复制下面一行文字,将它粘贴到sources.list文件的末尾

      deb http://dl.google.com/linux/chrome/deb/ stable main
      
    • 保存文件,然后使用wget下载谷歌的公钥,用apt-key将公钥添加到Debian

      wget https://dl-ssl.google.com/linux/linux_signing_key.pub
      sudo apt-key add linux_signing_key.pub
      sudo apt-get update
      sudo apt-get install google-chrome-stable
      
  • linux下需要给予chromedriver权限

    chmod 777 chromedriver
    
  • 运行

    python clockin.py
    
  • tips:

    • 目前仅支持chrome浏览器,其他浏览器需更改浏览器类型并安装相应驱动
    options = webdriver.ChromeOptions() # 你的浏览器
    self.driver = webdriver.Chrome(r'.\chromedriver.exe', options=options)  # 浏览器对应驱动
    
    • 对应驱动下载:

    • win 关闭 Ctrl + Break 或者(虚拟键盘) Ctrl + Fn + Pause

    • linux 关闭 Ctrl + C

    • VPS长时间运行后可能出现如下错误解决防范

      • 报错:
      Message: unknown error: session deleted because of page crash
      from unknown error: cannot determine loading status
      from tab crashed
      (Session info: headless chrome=81.0.4044.138)
      
      • 原因:内存泄漏造成的程序崩溃

      • 解决方案:

      1.在clockin.py中更改webdriver配置,放弃使用内存,转而使用硬盘,执行速度略微下降
      options.add_argument('--disable-dev-shm-usage')
      
      2.更改VPS系统配置,加大内容容量
      df -h /dev/shm
      sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
      mount -o remount /dev/shm
      df -h /dev/shm
      
  • 运行记录

    log

clockin's People

Contributors

mamazi0131 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.