Unofficial library for accessing Pinata's IPFS APIs
Project description
Pinata-Python
Unofficial IPFS python library for interacting with Pinata APIs
Installation
Run the following to install:
pip install Pinata-Python
Usage
- Register an account on Pinata
- Create a new api key on api keys page
- Copy your api key, api secret and secret key to be used below.
from pinata import Pinata
pinata = Pinata(ap_key, secret_key, access_token)
Pin a file
To upload your file to Pinata, you can either provide:
- Directory path of the file you want to upload
- File itself as a Byte Stream, eg. If from flask request:
file = request.files["file_name"]
Finally,
from pinata import Pinata
pinata = Pinata(ap_key, secret_key, access_token)
response = pinata.pin_file(file)
print(response)
Unpin a file
To unpin a file, you will need the file's IpfsHash.
from pinata import Pinata
pinata = Pinata(ap_key, secret_key, access_token)
response = pinata.unpin_file(ipfs_hash)
print(response)
Get all pins
If you want to get all pins in your account:
from pinata import Pinata
pinata = Pinata(ap_key, secret_key, access_token)
response = pinata.get_pins()
print(response)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pinata-0.0.1.tar.gz
(2.7 kB
view hashes)
Built Distributions
pinata-0.0.1-py3-none-any.whl
(3.2 kB
view hashes)
Pinata-0.0.1-py3-none-any.whl
(3.2 kB
view hashes)