rename txcache files to json

This commit is contained in:
Pavol Rusnak 2016-11-28 14:33:24 +01:00
parent 23f7feb438
commit ec966a0111
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
15 changed files with 4 additions and 4 deletions

View File

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

View File

@ -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