Giter Club home page Giter Club logo

fuckhanmu's Introduction

如何优雅地走汗姆

一个大规模、异步式、自动化走汗姆的工具。

感谢zyc199847提供的思路,以及goolhanrry, S-Ex1t提供的脚本。

本工具仅供学习交流,因使用本工具而造成的一切不良后果由使用者自行承担,与作者无关

已经实现的功能

  • 输入IMEI后获取姓名,对用户致以温暖的问候
  • 异步式运行,进入run()函数后无需等待
  • 定时运行,在Django后台设置后可以每天特定时间运行run()函数

环境依赖

pip install django celery flower
pip install django-celery django-celery-results
pip install requests
apt-get install rabbitmq-server

运行方式

首先在manage.py同级的文件夹下配置数据库

python manage.py makemigrations
python manage.py migrate

之后运行django

python manage.py runserver

再启动RabbitMQ

rabbitmq-server

运行celery worker,celery beat和flower

celery worker -A fuckhanmu_web
celery beat -A fuckhanmu_web
celery flower -A fuckhanmu_web

如果都没有报错的话应该就可以了。

说明

  1. 定时任务需要在django后台添加,需要先
python manage.py createsuperuser

之后输入用户名密码,再进入/admin目录下登陆就会看到一个叫做周期任务的表, 需要在里面手动添加任务,其中的crontab是定义在crontab表里的,这里只是调用了其中的 id,所以views.py里面的添加定时任务函数

PeriodicTask.objects.create(args=json.dumps([str(IMEI)]),
                            enabled=1,
                            name=request.session.get('ID'),
                            crontab_id=1,#需要修改
                            task='autorun.tasks.run',
                            )

里面的crontab_id得改一下,要不然会报错。

还没有实现的功能

  • 根据性别自动设置跑步距离
  • 自定义定时任务的时间
  • 停止正在运行的任务

fuckhanmu's People

Contributors

hackerliye avatar

Watchers

James Cloos 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.