Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lighthouse-web3/lighthouse-python-sdk
Python SDK for interacting with Lighthouse to store on IPFS, Filecoin
https://github.com/lighthouse-web3/lighthouse-python-sdk
filecoin ipfs ipfs-protocol lighthouse lighthouse-storage lighthouse-web3 web3 web3py
Last synced: 3 days ago
JSON representation
Python SDK for interacting with Lighthouse to store on IPFS, Filecoin
- Host: GitHub
- URL: https://github.com/lighthouse-web3/lighthouse-python-sdk
- Owner: lighthouse-web3
- License: gpl-3.0
- Created: 2022-09-22T07:19:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-21T07:50:05.000Z (over 1 year ago)
- Last Synced: 2024-10-29T14:19:30.666Z (about 2 months ago)
- Topics: filecoin, ipfs, ipfs-protocol, lighthouse, lighthouse-storage, lighthouse-web3, web3, web3py
- Language: Python
- Homepage: https://www.lighthouse.storage/
- Size: 86.9 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Lighthouse Python SDK
Lighthouse is a permanent decentralized file storage protocol that allows the ability to pay once and store forever. While traditionally, users need to repeatedly keep track and pay for their storage after every fixed amount of time, Lighthouse manages this for them and makes sure that user files are stored forever. The aim is to move users from a rent-based cost model where they are renting their own files on cloud storage to a permanent ownership model. It is built on top of IPFS, Filecoin, and Polygon. It uses the existing miner network and storage capacity of the filecoin network.
# Installation
```
pip install lighthouseweb3
```# Usage
### Instantiate the client
```python
from lighthouseweb3 import Lighthouse# use token from env variable LIGHTHOUSE_TOKEN
lh = Lighthouse()# or you can pass token as parameter
lh = Lighthouse(token="your_token")
```### Uploading a file
```python
from lighthouseweb3 import Lighthouse
lh = Lighthouse()
response = lh.upload("path/to/file")
print(response) # prints a dict containing the cid of the file
```### Uploading a directory
```python
from lighthouseweb3 import Lighthouse
lh = Lighthouse("my-lightouse-token")
response = lh.upload("path/to/directory")
print(response) # prints a dict containing the root cid of the directory
```# Testing
The tests are written with inheritance from the unittest module. To run the tests, run the following command:
```
pip install -r requirements.txt && python -m unittest discover
```or using nose2
```
pip install -r requirements.txt && python -m nose2
```