lgloege / web3storage

Python client for web3.storage
MIT License
4 stars 1 forks source link

web3storage

Project under active deveopment - not production ready


A Python3 package to interact with Web3.Storage.

This package requires the ipfs-car and carbites command line tool (see working with CAR files)

Install ipfs-car command line tool

npm install -g ipfs-car

This tool is needed to creat CAR files behind the scenes.

Install carbites CLI

npm install -g carbites-cli

This tool is needed to split CAR files into smaller chunks for upload

Already Implemented

Installation

This package is currently only installable via GitHub

pip install -e git+https://github.com/lgloege/web3storage#egg=web3storage

Using the Package

  1. Create an access token by first logging into your account and clicking on your username in the top right corner. Navigate to "Applications" and then "+new token" under "Personal access tokens". Keep this window open while you proceed to step 2 because the token is only displayed once.

  2. Store the token in ~/.web3_storage_token using the folowing command

    { echo 'ACCESS_TOKEN: your_access_token_here' } > ~/.web3_storage_token
  3. start using the ackage

    
    import web3storage

create a Client object

ws = web3storage.Client()

upload a file

ws.upload("~/test.file.txt", filename="test-file")



Notes
----------
This project is under active development. Here is a list of improvements:
- **CAR**: right this only works with "small" files (<100MB). Need a way to create and upload a CAR 
- **improve retrive**: retrieve needs some work. I think there is an encoding issue?
- **tests!**: need to test uploading and downloading files, not sure how to mock this
- **documentation**: need to setup a readthedocs
- **asyncronous functions**: use `asyncio` and `aiohttp` to write async functions. This could improve speed