Dalba created this task.
Dalba added a project: Pywikibot-core.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION

Currently if I have a page on English Wikipedia and I want to get the fawiki page that is linked to it, I would iterate over the language links and break the loop when I reach fawiki link:

for link in page.langlinks():
    if link.site.code == 'fa':
        break

I'm not sure if the above method is the best way to do it but I think it would be nice to have page.langlinks() accept a parameter like code such that when passed causes the function to only return the link for that specific code. So the code above would be written as:

link = page.langlinks(code='fa'):

The code should be passed to API as lllang parameter. See API's documentation for more info.


TASK DETAIL
https://phabricator.wikimedia.org/T142958

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dalba
Cc: Aklapper, pywikibot-bugs-list, Dalba, Mdupont, JJMC89, jayvdb
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to