Container for setting up your own webperf.se
213
Minimalistic client mainly running on PythonAnywhere.com, accessing different websites, or web-APIs, and scraping them.
The tests included in 2.x are:
Here are some suggestions on how to get started with the tests on your own computer. Actually, it is even easier to run the tests on a cloud environment such as PythonAnywhere - $ 5 / month - then the technical environment is ready to just upload the files.
You download the code itself from GitHub - webperf_core and place it in a good location on your computer.
There are two files that you need to adjust:
Another thing you need to do is to open the config.py file and change one thing. The line that looks like the following is incomplete:
googlePageSpeedApiKey = “”
Between the quotation marks, enter your Google Pagespeed API key. See the following header for how to do this.
Google Lighthouse API requires an API key. You can get one like this:
That code is your API key, that you should put in the config.py file in the source code, between the quotation marks on the line where you find googlePageSpeedApiKey.
You need to go through the following steps before you run the code:
If that command results in errors, you can try addressing Python3 instead:
python3 default.py -u https://webperf.se
Now it will begin testing.
| Argument | What happens |
|---|---|
| -h/--help | Help information on how to use script |
| -u/--url | website url to test against |
| -t/--test | run ONE test (use ? to list available tests) |
| -r/--review | show reviews in terminal |
| -i/--input | input file path (.json/.sqlite) |
| -i/--input-skip | number of items to skip |
| -i/--input-take | number of items to take |
| -o/--output | output file path (.json/.csv/.sql/.sqlite) |
| -a/--addUrl | website url (required in compination with -i/--input) |
| -d/--deleteUrl | website url (required in compination with -i/--input) |
| -L/--language | language used for output(en = default/sv) |
For instance, if you'd like to test https://yourwebsite.com, get the output as a JSON-file named my-report.json and also see the reviews in the prompt the statement is as follows:
python default.py -u https://yourwebsite.com -o my-report.json -r
If you want to test multiple URL:s and get the results as a CSV-file, then edit the file sites.json and run the following in your terminal to get the result in a file of your chosing, for instance results.csv in the application root:
python default.py -i sites.json -o results.csv
The file sites.json already exists in the repository's root. If you'd like to check multiple websites or URL:s you've to add them inside the square brackets, separated by commas. For instance:
{ "sites": [
{
"id": 0,
"url": "https://webperf.se/"
},
{
"id": 1,
"url": "https://surfalugnt.se/"
}
]
}
It is often worthwhile to google the error messages you get. If you give up the search then you can always check if someone on our Slack channel have time to help you, but don’t forget to paste your error message directly in the first post. Or, if you think your error are common for more people than yourself, post an issue here at Github.
The multiple language support is built on gettext in Python.
You could either follow the more technical suggestions below, or you perhaps would like an application such as Poedit (available on Macos, Linux and Windows).
To create a new language source file:
python3 <your path to pygettext.py > -d webperf-core -o locales/webperf-core.pot default.py checks.py
Copy the file to your locale, for Swedish it would be:
locales/sv/LC_MESSAGES/webperf-core.pot
Rename the file extension from .pot to .po
After you have translated everything you should run the following command from the LC_MESSAGES folder:
python3 <your path to msgfmt.py> -o webperf-core.mo webperf-core.po
You now have support for a new language, please send it to the official repository using a pull request :)
Locate your pygettext.py file:
locate pygettext.py
It might be as follows:
/Library/Frameworks/Python.framework/Versions/3.8/share/doc/python3.8/examples/Tools/i18n/pygettext.py
Locate your msgfmt.py file:
locate msgfmt.py
It might be as follows:
/Library/Frameworks/Python.framework/Versions/3.8/share/doc/python3.8/examples/Tools/i18n/msgfmt.py
The command can be:
python3 /Library/Frameworks/Python.framework/Versions/3.8/share/doc/python3.8/examples/Tools/i18n/pygettext.py -d webperf-core -o locales/webperf-core.pot default.py
The license used is the MIT license. This means that you can do whatever you want with the source code, including using it in commercial software and contexts. However, there is no guarantee or liability for the code.
You can contribute here at Github. By checking the code, trying the documentation, suggesting new tests, among other things.
Content type
Image
Digest
Size
340.7 MB
Last updated
over 5 years ago
docker pull puggan/webperf