Bot Followers
A web app to check whether followers of a given Twitter account are bots using Botometer. This repository started as a fork of Twitter Clean-up.
If you're looking for the CLI version, it's tagged.
Installing
- Make sure you meet these requirements:
- Twitter API keys
- Botometer API key
- For development, Docker Compose
- For production, Dokku
- Set up your local configuration variables; you can:
- run Createnv,
- or manually copy
.env.sample
as.env
editing it accordingly.
Development environment
To start the services use the default docker-compose up
. To prevent errors in the development environment, make sure the you have DEBUG=True
in your .env
file.
Deploy environment
Having a Dokku-ready server:
- Install the following Dokku plug-ins:
- PostgreSQL (or other database of your choice)
- RabbitMQ (or other Celery broker of your choice)
- Let's Encrypt
- Create an app for Bot Followers in Dokku, add it as a remote repository in your local Git repository, and activate the plug-ins.
- For each variable in
.env
, create an equivalent environment variable for your Dokku app.
Usage
The commands in this section might be prefixed by:
docker-compose run --rm django
in development modedokku run <app name>
in production mode
Dashboard
In order to get the app ready, before visiting /
at your server, you need to run migrations and create a user(s) to access the dashboard.
- Run migrations with
python manage.py migrate
- Create a super user for yourself with
python manage.py createsuperuser
It's recommended to create a proper user to access the dashboard without super powers: all you need to do is to:
- Login in as superuser create a new user that is staff
- Get back to the edit page of this user
- In the Permissions menu, add only the permission to view report to this new user
API
There is a simple JSON API at /api/
to share the report data without the need of user or login.
Management commands
CLI version
Importing data from the$ python manage.py import /path/to/borsalino.sqlite3
Check whether active/inactive jobs are in sync in the dashboard
$ python manage.py updatecelerytasks
Empty the queue of pending tasks
$ python manage.py purgecelerytasks
Contributing
Please, write tests, run checks, and format your code with Black:
$ python manage.py test
$ black .