Hi,

currently you can’t see the tags because this property is not retrieved. You have to modify the APISite.usercontribs() method to get it.

https://doc.wikimedia.org/pywikibot/master/_modules/pywikibot/site/_generators.html#GeneratorsMixin.usercontribs

Please create a Phabricator task for it. I think it is important enough to improve User.contributions() as well as APISite.usercontribs().

By the way, you can use collections.Counter to simplify your code.

https://docs.python.org/3/library/collections.html?highlight=counter#collections.Counter

Best
xqt

Am 22.05.2022 um 02:48 schrieb i.hate.spam.mail.here@gmail.com:

Hi,

I have this piece of code that counts edits:
<pre>
from pywikibot import Site, User

user = User(Site("en"), input('Enter user name: '))
counts = {}
for page, oldid, ts, comment in user.contributions(9999999999999):
   page.namespace()
   try:
       counts[str(page.namespace())] += 0
   except KeyError:
       counts.update({str(page.namespace()): 0})
   counts[str(page.namespace())] += 1
print('Totals:')
for key in counts:
   a = key.replace(':', '')
   if (a == ""):
       a = 'Main'
   print(a + ":", counts[key])
</pre>
My question is how to see the tags in edits. It seems that .contributions() does not return the tags.
_______________________________________________
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org