How to create a bot

Use pywikibot

pywikibot is a python library based on the Mediawiki API. In this notebook we will see how to use the API using Python with pywikibot and lay the groundwork to later develop a bot or tool for Wikidata.

Use pywikibot for Wikidata:

If you want to setup pywikibot on your computer, check this tutorial: https://www.wikidata.org/wiki/Wikidata:Pywikibot_-_Python_3_Tutorial/Setting_up_Shop

Quick steps:

Create a new directory for your project Clone pywikibot in this directory: git clone --recursive https://gerrit.wikimedia.org/r/pywikibot/core.git pywikibot Run python generate_user_files.py to create user-config.py Run python pwb.py login to login with your account

Let's create a bot to keep the population counts up to date

The data is available from Open Data Zurich, in the dataset Bevölkerung nach Stadtquartier, seit 1970.