The API to access the data is not the problem. The problem is that PyPI does not currently record the information: there is no per distribution artifact metadata collected. In the case of licensing information, making sense of metadata prior to version 2.4 is a lost cause, unless you want to try to interpret free text licensing information is a gazillion of different formats with fall back to ambiguously defined classifiers. Metadat 2.4 makes it much easier but still not trivial: the
License-Expressionmetadata field is not mandatory. Licensing information can be expressed linking to license text viaLicense-Filefields, or not present at all.
As has been pointed out repeatedly in prior discussions, license information reported for packages on PyPI is at best a strong hint as to the copyright license(s) covering downloads for that project. Anyone concerned about the actual licenses for all of the files contained within the downloads in each project’s release need to consult files shipped in those projects, or their upstream developers’ documentation. Recent metadata changes improve this, but do not address all possible complexities of applying copyright licenses in projects.