rename txcache files to json

pull/25/head
Pavol Rusnak 8 years ago
parent 23f7feb438
commit ec966a0111
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -1,3 +1,3 @@
recursive-include tests *.py *.sh
recursive-include tests *.py *.sh *.json
recursive-include bash_completion.d *.sh
include COPYING

@ -31,9 +31,9 @@ class TxApi(object):
self.url = url
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
j = json.load(open('txcache/' + cachefile))
j = json.load(open(cachefile))
return j
except:
pass
@ -43,7 +43,7 @@ class TxApi(object):
except:
raise Exception('URL error: %s' % url)
try: # saving into cache
json.dump(j, open('txcache/' + cachefile, 'w'))
json.dump(j, open(cachefile, 'w'))
except:
pass
return j

Loading…
Cancel
Save