mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-25 01:18:54 +00:00
rename txcache files to json
This commit is contained in:
parent
23f7feb438
commit
ec966a0111
@ -1,3 +1,3 @@
|
|||||||
recursive-include tests *.py *.sh
|
recursive-include tests *.py *.sh *.json
|
||||||
recursive-include bash_completion.d *.sh
|
recursive-include bash_completion.d *.sh
|
||||||
include COPYING
|
include COPYING
|
||||||
|
@ -31,9 +31,9 @@ class TxApi(object):
|
|||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
def fetch_json(self, url, resource, resourceid):
|
def fetch_json(self, url, resource, resourceid):
|
||||||
cachefile = '%s_%s_%s' % (self.network, resource, resourceid)
|
cachefile = 'txcache/%s_%s_%s.json' % (self.network, resource, resourceid)
|
||||||
try: # looking into cache first
|
try: # looking into cache first
|
||||||
j = json.load(open('txcache/' + cachefile))
|
j = json.load(open(cachefile))
|
||||||
return j
|
return j
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@ -43,7 +43,7 @@ class TxApi(object):
|
|||||||
except:
|
except:
|
||||||
raise Exception('URL error: %s' % url)
|
raise Exception('URL error: %s' % url)
|
||||||
try: # saving into cache
|
try: # saving into cache
|
||||||
json.dump(j, open('txcache/' + cachefile, 'w'))
|
json.dump(j, open(cachefile, 'w'))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return j
|
return j
|
||||||
|
Loading…
Reference in New Issue
Block a user