Skip to content

nftstorage/python-client

Repository files navigation

nft.storage

This client was generated via the OpenAPI schema and is experimental, unsupported, and may not work at all!

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/nftstorage/python-client.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/nftstorage/python-client.git)

Then import the package:

import nft_storage

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import nft_storage

Getting Started

Please follow the installation procedure and then run the following:

import time
import nft_storage
from pprint import pprint
from nft_storage.api import nft_storage_api
from nft_storage.model.check_response import CheckResponse
from nft_storage.model.delete_response import DeleteResponse
from nft_storage.model.error_response import ErrorResponse
from nft_storage.model.forbidden_error_response import ForbiddenErrorResponse
from nft_storage.model.get_response import GetResponse
from nft_storage.model.list_response import ListResponse
from nft_storage.model.unauthorized_error_response import UnauthorizedErrorResponse
from nft_storage.model.upload_response import UploadResponse
# Defining the host is optional and defaults to https://api.nft.storage
# See configuration.py for a list of all supported configuration parameters.
configuration = nft_storage.Configuration(
    host = "https://api.nft.storage"
)



# Enter a context with an instance of the API client
with nft_storage.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = nft_storage_api.NFTStorageAPI(api_client)
    cid = "bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u" # str | CID for the NFT

    try:
        # Check if a CID of an NFT is being stored by nft.storage.
        api_response = api_instance.check(cid)
        pprint(api_response)
    except nft_storage.ApiException as e:
        print("Exception when calling NFTStorageAPI->check: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.nft.storage

Class Method HTTP request Description
NFTStorageAPI check GET /check/{cid} Check if a CID of an NFT is being stored by nft.storage.
NFTStorageAPI delete DELETE /{cid} Stop storing the content with the passed CID
NFTStorageAPI list GET / List all stored files
NFTStorageAPI status GET /{cid} Get information for the stored file CID
NFTStorageAPI store POST /upload Store a file

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: Bearer authentication (JWT)

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in nft_storage.apis and nft_storage.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from nft_storage.api.default_api import DefaultApi
  • from nft_storage.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import nft_storage
from nft_storage.apis import *
from nft_storage.models import *

Releases

No releases published

Packages

No packages published