def GET(self): accountId = str(web.input().account) backend.updateAccount(accountId) account = backend.getAccount(accountId) [gevent.spawn(backend.updateAccount, friend) for friend in account.friends[:10]] return render.wishlist(account)
def POST(self, interface, method): web.header("Content-Type", "application/json") data = web.input() ret = {} if interface == "Accounts": if method == "GetAccount": if data.get("accounts", None) != None: ret["accounts"] = {} accounts = [backend.getAccount(data.accounts.strip(","))] for account in accounts: accountDict = {} accountDict["id64"] = account.id64 accountDict["name"] = account.name accountDict["avatarUrl"] = account.avatarUrl accountDict["url"] = account.url accountDict["wishlist"] = account.wishlist accountDict["friends"] = account.friends ret["accounts"][account.id64] = accountDict else: ret["error"] = "Error: Required parameter, accounts, not \ provided." return json.dumps(ret) elif interface == "Apps": if method == "GetApp": if data.get("apps", None) != None: ret["apps"] = {} apps = [backend.getApp(data.apps.strip(","))] for app in apps: appDict = {} appDict["appid"] = app.appid appDict["name"] = app.name appDict["imageUrl"] = app.imageUrl appDict["url"] = app.url ret["apps"][app.appid] = appDict else: ret["error"] = "Error: Required parameter, apps, not \ provided." return json.dumps(ret)