The python client libraries for IPFS that I tried were not compatible with the 0.11 version. IPFS exposes a web API though, so I wanted to see if I could do a basic to write to IPFS with a python http client.
- Post the README to the IPFS network, get it from another computer
- Connect to running IPFS node at localhost:5001
- Figure out what APIs I need to call
- Call them
- Find the files from another computer or with IPFS web extension
#!/usr/bin/python3
import requests
import dumper
# post should look like:
# Abspath: /absolute/path/to/file.txt
# Content-Disposition: form-data; name="file"; filename="folderName%2Ffile.txt"
# Content-Type: application/octet-stream
#
# ...contents...
files = {'file': open('README.md', 'rb')}
params = { "arg": "/README", "create" : "1"}
r = requests.post('http://localhost:5001/api/v0/files/write', params=params,
files=files)
dumper.dump(r)