3 from urlparse import urlparse, parse_qs
7 email = ADDON.getSetting('email')
8 password = ADDON.getSetting('password')
9 msl = MSL(email, password)
11 class MSLHttpRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
14 self.send_response(200)
17 length = int(self.headers['content-length'])
18 post = self.rfile.read(length)
20 data = post.split('!')
23 sid = base64.standard_b64decode(data[1])
24 b64license = msl.get_license(challenge, sid)
25 if b64license is not '':
26 self.send_response(200)
28 self.wfile.write(base64.standard_b64decode(b64license))
31 self.send_response(400)
33 self.send_response(400)
36 url = urlparse(self.path)
37 params = parse_qs(url.query)
38 if 'id' not in params:
39 self.send_response(400, 'No id')
41 # Get the manifest with the given id
42 data = msl.load_manifest(int(params['id'][0]))
43 self.send_response(200)
44 self.send_header('Content-type', 'application/xml')
46 self.wfile.write(data)