ipfs-shipyard / py-ipfs-http-client

A python client library for the IPFS API
MIT License
686 stars 200 forks source link

Adding files by URL (urlstore) #196

Open mcilrain opened 4 years ago

mcilrain commented 4 years ago

An experimental IPFS feature allows for files to be added by a provided URL, as far as I can tell py-ipfs-http-client does not support this.

I've been using the internal _client.request method to make a call to /urlstore/add but that is being deprecated with the IPFS daemon giving me the following message: The 'ipfs urlstore' command is deprecated, please use 'ipfs add --nocopy --cid-version=1 urlstore.go:50

I tried using _client.request to achieve this but was unable to, this API endpoint is a lot more complex, I would like to use features provided by this endpoint.

Please consider implementing support for providing a URL to /add.

Thank you.

RubenKelevra commented 4 years ago

Actually that's what's documented in the CLI --help for URLStore:

ipfs add --nocopy --cid-version=1 URL

Is this not working for you? 🤔

ntninja commented 4 years ago

Either way we need a test-case (and maybe also actual support code) for this.

leoherzog commented 4 years ago

Perhaps a utility similar to the js-ipfs url-source, that leverages Python's urllib.request?

ntninja commented 4 years ago

@leoherzog: Yeah, I tested this in the mean time and it is indeed the client that needs to download the remote resource before submitting it to the daemon. Actually downloading the files is not the problem here however, it mostly just hasn't been done (or even looked at until recently).

If you want to help with this, please let me know beforehand as the HTTP-library used internally will change in the upcoming version.