matej_suchanek created this task.
matej_suchanek added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
>>> dewiki = pywikibot.Site('de', 'wikipedia')
>>> page = pywikibot.Page(dewiki, 'Hitlerbauten')
>>> page.coordinates(primary_only=True)
Coordinate(lat=48.314187, lon=14.273416,
entity=http://www.wikidata.org/entity/Q2)
However, there are no primary coordinates (query
<https://de.wikipedia.org/w/api.php?action=query&format=json&prop=coordinates&list=&titles=Hitlerbauten&coprimary=primary>).
The method does:
if primary_only:
return self._coords[0] if len(self._coords) > 0 else None
else:
return self._coords
ie. chooses the first instance, which is wrong and can confuse bots and other
tools.
Primary coordinates are marked with `"primary": ""` key in the response.
TASK DETAIL
https://phabricator.wikimedia.org/T244963
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: matej_suchanek
Cc: Aklapper, pywikibot-bugs-list, matej_suchanek, Zkhalido, Viztor, Wenyi,
Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx,
jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs