Skip to main content

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

  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)

Project details


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)

Uploaded Source

Built Distributions

pinata-0.0.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Pinata-0.0.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page