def pushToIPFS(hstr, payload):
ipfsRetryCount = 5 # WARC->IPFS attempts before giving up
retryCount = 0
while retryCount < ipfsRetryCount:
try:
httpHeaderIPFSHash = pushBytesToIPFS(bytes(hstr))
payloadIPFSHash = pushBytesToIPFS(bytes(payload))
if retryCount > 0:
m = 'Retrying succeeded after {0} attempts'.format(retryCount)
print(m)
return [httpHeaderIPFSHash, payloadIPFSHash]
except NewConnectionError as e:
print('IPFS daemon is likely not running.')
print('Run "ipfs daemon" in another terminal session.')
sys.exit()
except:
attemptCount = '{0}/{1}'.format(retryCount + 1, ipfsRetryCount)
logError('IPFS failed to add, ' +
'retrying attempt {0}'.format(attemptCount))
# print(sys.exc_info())
retryCount += 1
return None # Process of adding to IPFS failed
评论列表
文章目录