From dc54376b15d090962c6db51ac13f32689532ba38 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 9 Feb 2014 04:47:19 +0100 Subject: [PATCH] use filecache module if possible --- .gitignore | 1 + trezorlib/api_blockchain.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index f3df5d2a31..500d46e856 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc *.bin +*.py.cache diff --git a/trezorlib/api_blockchain.py b/trezorlib/api_blockchain.py index 98d3abdfbf..56e4a0cdad 100644 --- a/trezorlib/api_blockchain.py +++ b/trezorlib/api_blockchain.py @@ -4,6 +4,14 @@ import binascii import urllib2 import json +try: + from filecache import filecache, MONTH +except: + def filecache(x): + def _inner(y): + return y + return _inner + MONTH = None import types_pb2 as proto_types @@ -18,6 +26,7 @@ class BlockchainApi(object): def submit(self, tx): raise Exception("Not implemented yet") + @filecache(MONTH) def get_tx(self, txhash): # Build protobuf transaction structure from blockchain.info d = self._raw_tx(txhash)