Ubuntu Pastebin

Paste from jdstrand at Tue, 1 Aug 2017 20:22:24 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
= Obtaining snap yaml for public snaps in stable channel =
curl -s -H 'X-Ubuntu-Series: 16' https://search.apps.ubuntu.com/api/v1/snaps/details/<SNAP-NAME> | jq '.snap_yaml_raw' | xargs echo -e


= Obtaining list of interfaces for all snaps in the stable channel in the public store =
#!/usr/bin/env python3
import urllib.request
import json

url = 'https://search.apps.ubuntu.com/api/v1/snaps/search'
params = '?fields=name,plugs,slots&confinement='
next_page = url + params

all_snaps = {}
while True:
    data = urllib.request.urlopen(next_page).read().decode('utf8')
    data = json.loads(data)
    for package in data['_embedded']['clickindex:package']:
        name = package['name'].split('.')[0]
        all_snaps[name] = package

    if data['_links'].get('next'):
        next_page = data['_links']['next']['href'] + '&confinement='
    else:
        break

for snap in sorted(all_snaps.keys()):
Download as text