problem with bot are best reported at I am currently experimenting with Codeberg with some of my minor projects so it is possible that I may miss notifications here
Go to file
Mateusz Konieczny 109be057bf suspend until files are grouped 2022-12-29 21:17:33 +01:00
images_for_readme_and_documentation document sponsorship 2022-12-18 18:22:58 +01:00
single_shot_scripts_likely_to_be_reused_in_future export code to a separate library 2022-09-11 13:56:48 +02:00
.gitignore add code to find matching quality images on Wikimedia Commons 2022-08-16 10:15:42 +02:00
LICENSE.MD initial commit 2022-01-07 09:58:51 +01:00
README.MD encourage to open an issue 2022-12-29 21:17:33 +01:00 rename scripts for better structure 2022-12-29 21:17:33 +01:00 suspend until files are grouped 2022-12-29 21:17:33 +01:00 ignore some garbage data 2022-11-21 20:38:09 +01:00 add TODO 2022-09-23 12:09:18 +02:00 fix more chaos caused by library extraction 2022-09-24 21:16:37 +02:00 export code to a separate library 2022-09-11 13:56:48 +02:00 split function 2022-12-18 18:23:53 +01:00 fix more chaos caused by library extraction 2022-09-24 21:16:37 +02:00 whitespace tweak 2022-11-14 14:43:23 +01:00 list one more license template 2022-11-21 20:39:09 +01:00 one more variant 2022-12-26 18:28:40 +01:00 more understendable log message 2022-09-10 14:03:44 +02:00 export code to a separate library 2022-09-11 13:56:48 +02:00 allow using specified login data 2022-03-25 09:23:41 +01:00
requirements.txt extract code to a separate library 2022-09-05 14:03:03 +02:00 rename scripts for better structure 2022-12-29 21:17:33 +01:00 make easier to rerun test in a full isolation 2022-12-18 18:20:44 +01:00 new copyright templates 2022-12-29 21:17:33 +01:00



This scripts were created to handle files at OpenStreetMap Wiki that were without proper licensing or with a mising source including running a simple bot.

It should be relatively easy to adapt it to other Mediawiki sites, but it was not tested.

Pull requests making easier to configure it for use with wikis other that OSM Wiki are welcome, as long as code is not getting much worse and more complicated.

This Mediawiki script can


Obtain code

Clone repository.

git clone
cd mediawiki_file_copyright_handler_bot


pip3 install -r requirements.txt

To install on specific Python version:

python3.9 -m pip install -r requirements.txt

Create config file with passwords

secret.json with content like

	"api_password": {
        "comment": "use - giving your standard username and password may work for now but can break at any time",
		"username": "User account@User account:_test",
		"password": "m3mfgy8j6bvwker29i2rsjk0r3y5060"

use to obtain password

Adapt to Wiki

If not used at OSM Wiki you will need to add some configuration - pull requests are welcomed!

Base API url

Likely base api url needs to be passed - right now it defaults to OSM Wiki.

After base api url is defined and passed around defaulting to OSM Wiki likely should be removed.

It is fine to rewrite script so it will require API as a parameter.


Templates are likely to be different - so it would be necessary to also specify them somehow in config.



Why not pywikibot?

Pywikibot has some weird, arcane architecture - and extra complexity on top of quite simple API is not actually useful.

Especially as I consider rewriting it in JS and making available as a web page.

Why pywikibot is bad? For example it requires creation of file with some arcane config for start.

I admit that

usernames['osm']['en'] = 'Actual username'

is not terribly complex once magic and poorly documented syntax is figured out. But having an extra poorly defined and unnecessary config file somewhere in location decided by library is just asking for problems and bugs.

Using pywikibot requires more learning about pywikibot internals than about Mediawiki API. This is not useful, especially as pywikibot in practice (in my experience) has much worse documentation and is less clear and harder to debug than direct API calls.

In this case it seems simpler to reinvent and document wheel using well documented component over trying to reconstruct pywikibot documentation from complex source code, stackoverflow questions and discussions scattered elsewhere.

Pywikibot also required passing some magic values (for example 6 for file namespace index)


Thanks to people from Wikimedia Hackathon telegram channel for pointing me in right direction when dealing with Wikimedia API!

Especially to Bohdan Melnychuk.


Development of this tool was partially sponsored by foundation as part of the NGI0 Discovered fund (project 2021-06-056 - done as part of StreetComplete development and improving related ecosystem). Thanks for help!