Coder Social home page Coder Social logo

qnyf's Introduction

Introduce

此脚本用于西华大学青柠疫服打卡系统PS:此脚本实例于centos7上实现

Usage

安装依赖

安装selenium库

pip install selenium #pip3 install selenium

安装google chrome浏览器

sudo yum install google-chrome-stable_current_x86_64.rpm

chrome路径

which google-chrome-stable

做软连接

ln -s 路径 /usr/bin/chrome

解决root用户不能运行Chrome

vim /opt/google/chrome/google-chrome #将最后一行改写为: exec -a "$0" "$HERE/chrome" "$@" --no-sandbox $HOME

chromedriver安装

验证google Chrome版本

google-chrome-stable -version

下载ChromeDriver安装

选择对应版本下载,访问:https://npm.taobao.org/mirrors/chromedriver wget https://npm.taobao.org/mirrors/chromedriver/72.0.3626.7/chromedriver_linux64.zip(这里的版本号需要手动更改成对应浏览器的版本)

解压安装包(没有zip解压,执行yum -y install zip)

unzip chromedriver_linux64.zip

移动到/usr/bin目录下(或者移动到指定目录后排至软链接)

sudo mv chromedriver /usr/bin

赋予Chromedriver权限

chmod +x /usr/bin/chromedriver

测试chromedriver安装

chromedriver image

代码使用

PS:此代码健壮性不好,望谅解
代码仅需修改line8-10,以及line87中的Sno、Sname、Password 以及对应api的账号密码
PS:此api为验证码识别,地址为http://www.ttshitu.com/
image image
更多api使用详情见开发文档
http://www.ttshitu.com/docs/python.html#pageTitle

脚本自动执行

crontab -e
crontab格式:
image

python所在路径查看

which python #which python3

py文件路径查看

find / -name xxx.py

最终格式

0 0 * * * python所在路径 需执行的.py文件路径
这样就实现了每天0点定时打卡

qnyf's People

Contributors

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