Skip to content

GrishonNganga/Pinata-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinata-Python

Unofficial IPFS python library for interacting with Pinata APIs

Installation

Run the following to install:

pip install pinata

Usage

  1. Register an account on Pinata
  2. Create a new api key on api keys page
  3. 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:

  1. Directory path of the file you want to upload
  2. 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)

About

Unofficial library for accessing Pinata's IPFS APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages