Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why files are UNPINNED after published? #5

Closed
Marionette-yixuan opened this issue Apr 5, 2023 · 2 comments
Closed

Why files are UNPINNED after published? #5

Marionette-yixuan opened this issue Apr 5, 2023 · 2 comments

Comments

@Marionette-yixuan
Copy link

I use cid = ipfs_api.publish(file_name) to publish a file to IPFS,
and ipfs-cluster-ctl status cid shows that the file is unpinned on every peer.
I tried ipfs_api.pin(cid) but it's not helping.

What should I do?

@abrichr
Copy link

abrichr commented May 2, 2023

@Marionette-yixuan can you please share how you resolved this issue? Thank you! 🙏

@Marionette-yixuan
Copy link
Author

@Marionette-yixuan can you please share how you resolved this issue? Thank you! 🙏

@abrichr

File download with ipfs_api works well, you can call shell command to upload file.
Or you can upload and download files through http request, which I think is a much better way.
Codes I use to upload and download:

# upload
response = requests.post(f'http://127.0.0.1:5001/api/v0/add', files=data)
cid = response.json()['Hash']

# download
response = requests.post(f'http://127.0.0.1:5001/api/v0/cat?arg={cid}')
data = response.content

You may change the port to 9095 if using ipfs-cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants