def GET(self, name): web.header('Content-Type', 'application/json') parts = name.split('/') if len(parts) == 1: return json.dumps(repo.get_product(name)) else: if parts[0] == "add": print "Adding product: " + name repo.add_product({'asin':parts[2], 'url':web.input()['url'], 'imgurl':web.input()['imgurl'], 'name':urllib.unquote(web.input()['product'])})
def GET(self, name): web.header('Content-Type', 'application/json') parts = name.split('/') if len(parts) == 1: return json.dumps(repo.get_product(name)) else: if parts[0] == "add": print "Adding product: " + name repo.add_product({ 'asin': parts[2], 'url': web.input()['url'], 'imgurl': web.input()['imgurl'], 'name': urllib.unquote(web.input()['product']) })
def GET(self, name): web.header('Content-Type', 'application/json') print name parts = name.split('/') if len(parts) == 3: if parts[0] == "add": self.sendFacebookNotification() repo.add_product({'asin':parts[2], 'url':web.input()['url'], 'imgurl':web.input()['imgurl'], 'name':urllib.unquote(web.input()['product'])}) repo.add_share(parts[1], parts[2], web.input()['sharetext']) return '{}' else: return json.dumps(repo.get_share(parts[1], parts[2])) else: return json.dumps(repo.get_shares(parts[0]))
def GET(self, name): web.header('Content-Type', 'application/json') print name parts = name.split('/') if len(parts) == 3: if parts[0] == "add": self.sendFacebookNotification() repo.add_product({ 'asin': parts[2], 'url': web.input()['url'], 'imgurl': web.input()['imgurl'], 'name': urllib.unquote(web.input()['product']) }) repo.add_share(parts[1], parts[2], web.input()['sharetext']) return '{}' else: return json.dumps(repo.get_share(parts[1], parts[2])) else: return json.dumps(repo.get_shares(parts[0]))