def transfer_from_op(op, ts, new_block_id, block_num, trx_in_block, op_in_trx): print op to_id = op[1]['to'] from_id = op[1]['from'] amount = op[1]['amount'] fee = op[1]['fee'] memo = get_message(op[1]) amount_asset = cache.get_asset(amount['asset_id']) fee_asset = cache.get_asset(fee['asset_id']) transfer = Transfer(block_id=new_block_id, from_id=from_id, from_name=cache.get_account(from_id)['name'], to_id=to_id, to_name=cache.get_account(to_id)['name'], amount=amount['amount'], amount_asset=amount['asset_id'], fee=fee['amount'], fee_asset=fee['asset_id'], block_num=block_num, trx_in_block=trx_in_block, op_in_trx=op_in_trx, timestamp=parse(ts), memo=memo[:32] if memo else None, processed=0) return transfer
def resolve_account(self, args, context, info): account_name = args.get('name') if not account_name: raise print 'ACA ESTYO cache.get_account_id' account_id = cache.get_account_id(ACCOUNT_PREFIX + account_name) print 'OSHE MIRA ', account_id return Account(cache.get_account(account_id))
def get(self): injectHeaders(self) user = self.get_argument("account") account = cache.get_account(user) account["json"] = json.dumps(account) account["description"] = unescape(account["description"]) account["deleted_tweets"] = database.getDeletedTweetsData(int(user)) account["deleted_tweets_length"] = len(account["deleted_tweets"]) if "retreived" in account: account["retrieved"] = account[ "retreived"] # to correct for a simple spelling error that is prevalent in database... self.render("pages/figure.html", brand=brand, figure=account)
def resolve_type_(self, args, context, info): f = cache.get_account(self.op['from'])['name'] # print 'comerla ...' # print args # print '******************' # print context # print '******************' # print info # print '******************' #HACK: x = info.operation.selection_set.selections[0].arguments[0].value.value if x == f: return 'sent' return 'received'
def get(self): injectHeaders(self) user = self.get_argument("account") tweet = self.get_argument("tweet") tweet_data = database.getTweet(user, tweet) account = cache.get_account(user) account["json"] = json.dumps(account) account["description"] = unescape(account["description"]) account["deleted_tweets"] = database.getDeletedTweetsData(int(user)) account["deleted_tweets_length"] = len(account["deleted_tweets"]) tweet_data["json"] = json.dumps(tweet_data) tweet_data["text"] = unescape(tweet_data["text"]) if "favorite_count" not in tweet_data: # for some reason if =0 twitter omits favorite count tweet_data["favorite_count"] = 0 if "retweet_count" not in tweet_data: # for some reason if =0 twitter omits retweet count tweet_data["retweet_count"] = 0 if "retreived" in tweet_data: tweet_data["retrieved"] = tweet_data[ "retreived"] # to fix a little typo that is prevalent in the database... self.render("pages/tweet.html", brand=brand, figure=account, tweet=tweet_data)
def get(self): injectHeaders(self) user = self.get_argument("account") deleted = bool(self.get_argument("deleted", default=False)) tweets = [] title = "Tweets of @" if deleted: title = "Deleted " + title tweets = database.getDeletedTweetsData(int(user)) else: tweets = database.getAllTweetsInDatabase(int(user)) last = int(self.get_argument("last", default=len(tweets))) account = cache.get_account(user) title = title + account["screen_name"] account["json"] = json.dumps(account) tweets_sorted = sorted(tweets, key=lambda tweet: int(tweet["id"]), reverse=True) self.render("pages/tweets.html", figure=account, brand=brand, title=title, statuses=render(tweets_sorted[:last]))
def resolve_issuer(self, args, context, info): return Account(cache.get_account(self.asset['issuer']))
def resolve_to(self, args, context, info): return Account(cache.get_account(self.op['to']))
def resolve_from_(self, args, context, info): return Account(cache.get_account(self.op['from']))
def resolve_account_to_list(self, args, context, info): return Account(cache.get_account(self.op['account_to_list']))
def resolve_authorizing_account(self, args, context, info): return Account(cache.get_account(self.op['authorizing_account']))