2
import os, json, sys, re, pprint
3
from landscape_api.base import API, HTTPError
5
# change these accordingly
6
uri = "https://landscape.canonical.com/api/"
7
key = "<please insert your key here>"
8
secret = "<pleaseinsert your secret here>"
10
if key == "<please insert your key here>":
11
print "please add your personal key in file"
14
if key == "<please insert your secret here>":
15
print "please add your personal secret in file"
18
api = API(uri, key, secret)
20
usns= api.get_usn_time_to_fix(query="in_last=30")
22
print ("\nGot server error:\n"
24
"Message: %s\n") % (e.code, e.message)
27
print "USN analyze for the last 30 days:"
28
print "#################################"
31
print "No USN data available"
33
for values in sorted(usns, key=len):
34
print "USNs patched within a range of ", values, "days =>", usns[values]