is there a simple method to get the user gender (if provided)? User.getprops does not give that info.
masti
Hey Masti,
I think the simplest way is to patch pwb with the patch below. This will make userprops return the gender as well :) The "nice" way would probably be to write your own function that calls that particular API functionality.
Strainu
diff --git a/pywikibot/site.py b/pywikibot/site.py index 1f8f5344..013bb566 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -4914,7 +4914,7 @@ class APISite(BaseSite): usernames = u"|".join(usernames) usgen = api.ListGenerator( "users", ususers=usernames, site=self, - usprop="blockinfo|groups|editcount|registration|emailable" + usprop="blockinfo|groups|editcount|registration|emailable|gender" ) return usgen
2017-10-11 0:03 GMT+03:00 masti mastigm@gmail.com:
is there a simple method to get the user gender (if provided)? User.getprops does not give that info.
masti
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
Thanks Strainu, but I think that will give info on the logged user. I am looking to find this info on the specific user. So taking any Class User object
masti
On 10.10.2017 23:31, Strainu wrote:
Hey Masti,
I think the simplest way is to patch pwb with the patch below. This will make userprops return the gender as well :) The "nice" way would probably be to write your own function that calls that particular API functionality.
Strainu
diff --git a/pywikibot/site.py b/pywikibot/site.py index 1f8f5344..013bb566 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -4914,7 +4914,7 @@ class APISite(BaseSite): usernames = u"|".join(usernames) usgen = api.ListGenerator( "users", ususers=usernames, site=self,
usprop="blockinfo|groups|editcount|registration|emailable"
usprop="blockinfo|groups|editcount|registration|emailable|gender" ) return usgen
2017-10-11 0:03 GMT+03:00 masti mastigm@gmail.com:
is there a simple method to get the user gender (if provided)? User.getprops does not give that info.
masti
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
Hi Masti,
I don't think so. If you look at the function that contains the line I changed, it takes one or more usernames as parameters. Also, Xqt already uploaded a patch [1] - the unit tests should be self-explanatory on the usage of the function and the result.
Strainu
[1] https://gerrit.wikimedia.org/r/#/c/383532/
2017-10-11 9:54 GMT+03:00 masti mastigm@gmail.com:
Thanks Strainu, but I think that will give info on the logged user. I am looking to find this info on the specific user. So taking any Class User object
masti
On 10.10.2017 23:31, Strainu wrote:
Hey Masti,
I think the simplest way is to patch pwb with the patch below. This will make userprops return the gender as well :) The "nice" way would probably be to write your own function that calls that particular API functionality.
Strainu
diff --git a/pywikibot/site.py b/pywikibot/site.py index 1f8f5344..013bb566 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -4914,7 +4914,7 @@ class APISite(BaseSite): usernames = u"|".join(usernames) usgen = api.ListGenerator( "users", ususers=usernames, site=self,
usprop="blockinfo|groups|editcount|registration|emailable"
usprop="blockinfo|groups|editcount|registration|emailable|gender" ) return usgen
2017-10-11 0:03 GMT+03:00 masti mastigm@gmail.com:
is there a simple method to get the user gender (if provided)? User.getprops does not give that info.
masti
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot