LP API me.getArchiveSubscriptionURLs() does not return all my private ppa subscriptions

Asked by Dan Streetman on 2021-03-05

I'm subscribed to a lot of private ppas, but the API only returns a small subset, e.g.:

$ lp-shell

Connected to LP service "production" with API version "devel":
Note: LP can be accessed through the "lp" object.
In [1]: import re

In [2]: for u in lp.me.getArchiveSubscriptionURLs():
   ...: print(re.sub(r':[^:]+@', ':XXXXXXXX@', u))
   ...:
https://ddstreet:<email address hidden>/ubuntu-advantage/security-benchmarks/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng-att/sf276449/ubuntu
https://ddstreet:<email address hidden>/ubuntu-esm/esm-apps-updates/ubuntu
https://ddstreet:<email address hidden>/jedis/jarjar/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/soscleaner/ubuntu
https://ddstreet:<email address hidden>/ubuntu-esm/esm/ubuntu
https://ddstreet:<email address hidden>/ubuntu-esm/esm/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/ddstreet/ubuntu
https://ddstreet:<email address hidden>/jedis/jarjar/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/sf211421hf/ubuntu
https://ddstreet:<email address hidden>/jedis/obi-wan/ubuntu
https://ddstreet:<email address hidden>/jedis/test-deletedppa1/ubuntu
https://ddstreet:<email address hidden>/jedis/test-deletedppa/ubuntu
https://ddstreet:<email address hidden>/canonical-livepatch-client/aws/ubuntu
https://ddstreet:<email address hidden>/canonical-livepatch-client/aws/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/precise-esm-proposed/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/sf155616/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/sf107001-deletedppa/ubuntu
https://ddstreet:<email address hidden>/canonical-is-fwgen/ppa/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/sf99522/ubuntu
https://ddstreet:<email address hidden>/canonical-support-eng/sf94878-deletedppa/ubuntu
https://ddstreet:<email address hidden>/canonical-livepatch/updates/ubuntu
https://ddstreet:<email address hidden>/canonical-sustaining-merged/ppa-testing-deletedppa/ubuntu

In [3]:

The web page for my subscriptions lists way more:
https://launchpad.net/~ddstreet/+archivesubscriptions

Is this a LP bug? Or am I using the API wrong?

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Colin Watson
Solved:
2021-03-08
Last query:
2021-03-08
Last reply:
2021-03-05
Ioana Lasc (ilasc) said : #1

Hi Dan

It is expected that the the API endpoint you're using (getArchiveSubscriptionURLs) shows you only a subset of what you're subscribed to as it returns only the list of private archives, whereas the +archivesubscriptions page will list the entire set of archives that you have access to.

Dan Streetman (ddstreet) said : #2

> the +archivesubscriptions page will list the entire set of archives that you have access to

I think I see the problem; while I already have a subscription to some private ppas, the password doesn't show up in my SubscriptionURLs() list until I click on the 'View' link for the private PPA in my +archivesubscriptions list.

I assume this is an intentional design, for no password to be created until someone clicks on the 'View' link from a browser, and then the pw is created and added to their subscriptionurls list?

Best Colin Watson (cjwatson) said : #3

getArchiveSubscriptionURLs and +archivesubscriptions both show only private PPAs, because archive subscriptions only exist for private PPAs.

Dan's latest comment is correct: a private PPA owner can grant you access to their PPA if they want, but in order to have an active token you need to activate it via the "View" link. +archivesubscriptions shows you both active and inactive subscriptions because it's part of the workflow for activation, but getArchiveSubscriptionURLs only shows you the active ones.

Dan Streetman (ddstreet) said : #4

Thanks Colin Watson, that solved my question.