Ambassador counting by region

This is my approach to get more (and hopefully better) metrics about the Ambassadors Project with my poor python programming skills. During March I added the new ambassadors by hand to the statistics page. That’s not the way we want to go…Francesco Crippa made a python script to count the members of the Fedora Ambassadors Project. His idea was to collect the diffs of the Country List page. Unfortunately this page is updated manually and because of that not very reliable. IMHO the better way is to get the data from the several category pages (for example CategoryAmbassadorsFrance). The personal wiki pages of the ambassadors are often more up-to-date because Thomas Chung add the category after verification.

The script is quite simple and at the moment just a working prototype. There is a list of countries. With this list the script will get all links from the category pages (incl. the wiki names), then do some work with regex and print out a number. This number is the count of all ambassadors in the selected countries.

Download: amb_count.py

If you are a python pro feel free to tell me what I can do better in this script. Any kind of suggestions are welcome.

Maybe I will expand this script. I would like to have a log function (writing the data to a file with time and data), selection of the area through user input, and some other small thing like error handling and a test if the the script got all data form the Fedora wiki. At the moment with moinmoin it’s a pain and there have to be more than one run to get all the data, 502 Proxy Error…sooner or later everything will be fine with mediawiki.

This entry was posted in Fedora. Bookmark the permalink.

One Response to Ambassador counting by region

  1. Michael says:

    Don’t have time to offer up too many suggestions, but if you don’t compile your regex in the for loop each time it should run faster — compile it outside the “for”. The idea is to build the regular expression once and use it repeatedly for different data.

    –Michael DeHaan

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.