I am a beginner trying to upload and access data from an IPFS network. I am currently going through a tutorial on the same. This is the code on their site.
# upload
import requests
import json
files = {
'fileOne': ('Congrats! This is the first sentence'),
}
response = requests.post('https://ipfs.infura.io:5001/api/v0/add', files=files)
p = response.json()
hash = p['Hash']
print(hash)
# retreive
params = (
('arg', hash),
)
response_two = requests.post('https://ipfs.infura.io:5001/api/v0/block/get', params=params)
print(response_two.text)
I tried it and it is working fine. However, instead of just 1 file containing 1 record like this-
files = {
'fileOne': ('Congrats! This is the first sentence'),
}
I want to upload multiple such files. For example, employee details which consist of multiple rows of data. I have been trying multiple ways but have been unsuccessful. Can someone mention how to do this? Thank you.
filesdictionary with the files you need to add to IPFS. However, note that for larger files you might want to read the original file chunk by chunk and stream the request instead.