Skip to content

frefrik/covid19norge-twitter

Repository files navigation

COVID-19 Norge - Twitter Bot

Description

Twitter bot for tracking live COVID-19 statistics in Norway.

The bot autoposts live updates with a Twitter developer account:

twitter:
  auth:
    consumer_key: <CONSUMER_KEY>
    consumer_secret: <CONSUMER_SECRET>
    access_token: <ACCESS_TOKEN>
    access_token_secret: <ACCESS_SECRET>

DataSource

https://github.com/frefrik/covid19norge-data (accessed through covid19norge.no/api)

Features

  • Live updates
    • Tested
    • Confirmed cases
    • Deaths
    • Admissions
    • Respiratory
    • Vaccine doses
    • Smittestopp
  • Graphs
    • Tested
    • Confirmed cases
    • Dead
    • Hospitalized
    • Vaccine doses
    • Smittestopp
  • RSS
    • News from FHI (Folkehelseinstituttet)
    • News from the goverment (Regjeringen)

Screenshots

Daily Summary Statistics

c19_graphs c19_stats

Live updates (click to expand)

c19_live

RSS (click to expand)

c19_rss-1 c19_rss-2

Installation

Docker

Create a file named docker-compose.yml and add the following:
version: '3.8'

services:
  bot:
    container_name: covid19norge-twitter
    image: frefrik/covid19norge-twitter:latest
    restart: unless-stopped
    environment:
      - TZ=Europe/Oslo
    volumes:
      - ./config:/app/bot/config
      - ./data:/app/bot/data
Download and edit bot configuration
$ mkdir -p config \
  && wget https://raw.githubusercontent.com/frefrik/covid19norge-twitter/main/config/config.dist.yml -O config/config.yml
Start bot
$ docker-compose up -d

git + Docker

Clone the repository
$ git clone https://github.com/frefrik/covid19norge-twitter.git
$ cd covid19norge-twitter/
Copy config.dist.yml to config.yml and edit configuration
$ cp config/config.dist.yml config/config.yml
Start bot
$ docker-compose up -d

Command line

Install dependencies
$ pip install -r requirements.txt
Copy config.dist.yml to config.yml and edit configuration
$ cp config/config.dist.yml config/config.yml
Start bot
$ screen -dmS covid19norge-twitter python clock.py
Attaching to the screen
$ screen -r covid19norge-twitter

Docker Notes

Editing config

If config.yaml is updated while bot is running, the container must be restarted to use the updated config.

$ docker restart covid19norge-twitter
Bot logs

Use docker logs -f covid19norge-twitter to show informational logs.