Skip to content

Instantly share code, notes, and snippets.

@jcurbelo
Last active June 20, 2024 19:03
Show Gist options
  • Save jcurbelo/5cda994d82c8428898a7723cd712cb32 to your computer and use it in GitHub Desktop.
Save jcurbelo/5cda994d82c8428898a7723cd712cb32 to your computer and use it in GitHub Desktop.
Upload Multiple Tokens to Nifty Kit
import requests
import json
data = {}
with open('nifty.json') as f:
data = json.load(f)
url = "https://api.niftykit.com/v3/collections/tokens"
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
response = requests.request("POST", url, json=data, headers=headers)
@jcurbelo
Copy link
Author

A simple script to upload tokens metadata to Nifty Kit using requests

How to use it

You must have a nifty.json file on the same dir as this script. Must follow the following specs:

{
  "data": [
    {
      "name": "Sample #1",
      "description": "This is a sample #1",
      "attributes": [
        {
          "trait_type": "color",
          "value": "red"
        }
      ],
      "image": "https://ipfs.io/ipfs/QmVsy5Uq8CuA7GPoyJFpsNQoDiC1csdJVEJU7SoveUAmzp",
      "animation_url": "",
      "background_color": "",
      "youtube_url": "",
      "external_url": ""
    },
 {
      "name": "Sample #2",
      "description": "This is a sample #2",
      "attributes": [
        {
          "trait_type": "color",
          "value": "blue"
        }
      ],
      "image": "https://ipfs.io/ipfs/QmVsy5Uq8CuA7GPoyJFpsNQoDiC1csdJVEJU7SoveUAmzp",
      "animation_url": "",
      "background_color": "",
      "youtube_url": "",
      "external_url": ""
    }    
  ]
}
  1. Install requests
pip install requests
  1. Run this script!
python upload_nifty_kit.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment