The main purpose of `site_size_rechecker.py` script is to automate the checking of older sites that are listed in the 512kb.club and ensuring that the size is updated.
## How it works
1. Read `sites.yml` file
1. Analyze `last_checked` key pair
1. Sort key pair in ascending order _earliest first_
1. Non-date values are listed before dated values such as **"N/A"**
1. Create an account with [GTmetrix.com](https://gtmetrix.com/)
1. Go to [account settings](https://gtmetrix.com/dashboard/account) and generate an API Key
1. Install **ruamel.yaml** Python library (available via [pip](https://pypi.org/project/ruamel.yaml/) or a [package manager](https://archlinux.org/packages/community/any/python-ruamel-yaml/)).
1. It is [recommened](https://github.com/aisayko/python-gtmetrix/issues/13#issuecomment-781785672) to just Git clone the repo as they only require [requests](http://python-requests.org/) which have [pip](https://pypi.org/project/requests/) and an [OS package](https://archlinux.org/packages/extra/any/python-requests/).
1. Create authintication file named `myauth.py` with the following format:
_Note:_ Under the new plan you will first receive 100 credits from GTmetrix for testing. after which you will get a refill of 10 credits every day at `8:45 PM +0000`. This script uses 0.7 credits for each site check. which is about 14 site reports per day per person
Successful output will generate a table in markdown file which _**Must**_ be put in the PR such as [#450](https://github.com/kevquirk/512kb.club/pull/450)
_Note:_ In the middle of each line it takes about 30 seconds in wait-time to output the rest of the line. This is due to the time it takes to finish the GTmetrix scan
edit the [python-gtmetrix/gtmetrix/interface.py](https://github.com/aisayko/python-gtmetrix/blob/master/gtmetrix/interface.py#L85) file and change the number `30` in line 85 to a smaller number - for example, change this line from
To exclude a site from checks you can either remove the site or change the `last_checked` Key-Pair to today's date or a date in the future to make it last in the list.
To debug why the script "hangs" when checking some site, edit the [ python-gtmetrix/gtmetrix/interface.py](https://github.com/aisayko/python-GTmetrix/blob/master/GTmetrix/interface.py#L86) file
Currently, this script doesn't check any errors returned by GTmetrix.com API. That's the next item on my list. Moreover, I will get rid of python-GTmetrix dependency, since it adds more troubles than benefits.