+ def POST(self, request):
+ if request == 'ingest_content':
+ # Read JSON parameters.
+ json_data = web.data()
+ data = json.loads(json_data)
+
+ # Add job weight to CIS load.
+ self.shared.load += data["weight"]
+ print 'load in POST is', self.shared.load
+
+ # Submit job.
+ self.shared.queue.put(data)
+
+ return 'Job submitted.'
+ else:
+ web.badrequest()
+ return ""
+
+
+if __name__ == '__main__':
+ # The BitTorrent object implements a NextShare (Tribler) BitTorrent
+ # client for seeding, downloading etc.
+ global bit_torrent
+ bit_torrent = bt.BitTorrent()
+
+ # Web service.
+ urls = ('/(.*)', 'Service')
+ service = web.application(urls, globals())
+ service.run()