Giter Club home page Giter Club logo

pinatapy's People

Contributors

arseniiarsenii avatar freddie71010 avatar kevinbird15 avatar khssnv avatar makyul avatar patara43 avatar rajkaria avatar smehnov avatar tubleronchik avatar vourhey avatar zinootje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pinatapy's Issues

Metadata/options need conversion to JSON

After the last update to properly handle options data, providing options.pinataMetadata (and perhaps also options.pinataOptions) still error out.

Input:

pinata_metadata = {"pinataMetadata": { "name": "A Test File" }}
pinata.pin_json_to_ipfs(file, options=pinata_metadata)

Output:

{'status': 400, 'reason': 'Bad Request', 'text': '{"error":"Invalid JSON provided"}'}

It appears providing the metadata body as a JSON string solves this.

import json
metadata_content = { "name": "A Test File" }
pinata_metadata = {"pinataMetadata": json.dumps(metadata_content)}
pinata.pin_json_to_ipfs(file, options=pinata_metadata)

I am not sure if this should be done user-side, because this is not documented. And of course, thanks for this script!

Filenames in IPFS

I am wondering if you could help. Previously I was uploading a directory via pin_file_to_ipfs and the URL would be hash/filename. Now it has changed to hash/fullpath/filename. Is there anyway to remove the fullpath and revert back to the /hash/filename?

upload folder root path

Thanks for the SDK, it works very well. When i give the path to the folder it looks something like

/Users/username/folder/

when i upload a folder manually it will resolve all files to be in root such that when i open the gateway url with my hash i get immediately the contents i am looking for.

the sdk is currently creating a folder structure where it takes a few layers to go from root hash to my contents.

this is important i believe as the merkle tree takes a longer time to build the more layers it has.

is there a way I can accomplish this? perhaps i am using your library incorrectly?

would greatly appreciate your help.

Unexpected token - in JSON at position 0

Hi. There is an issue with file upload. It uploads the first one but returns an error message for all the following.

>>> from pinatapy import PinataPy
>>> pinata = PinataPy(API_KEY, API_SECRET)
>>> pinata.pin_file_to_ipfs(path_to_file)
{'IpfsHash': 'Qm...',
 'PinSize': ...,
 'Timestamp': '...',
 'isDuplicate': True}
>>> pinata.pin_file_to_ipfs(path_to_file)
{'status': 400, 'reason': 'Bad Request', 'text': '{"error":{"reason":"UNKNOWN_REASON","details":"Unexpected token - in JSON at position 0"}}'}

Versions

Python: 3.9.9
pinatapy-vourhey: 29ad523

How to avoid uploading folder path?

Hello,
i have tried using a folder but im sadly getting the entire /home/documents/ ecc. that i would like to "hide"
is there a way to avoid uploading the entire path of the folder?

thank you for this nice library

edit1: i tried changing to res = requests.post(self.__endpoint + url_suffix, files=files, data/params = options, headers=self.headers) to pass wrapWithDirectory = false but im always the the same cid with same directory, i also tried on files["pinataOptions"] to add the wrapWithDirectory = false but always getting the same cid with the path

Edit2:

i manged to do it with:

files = [("file",(str(pathlib.PurePath(file).parent.name + "/"+ pathlib.PurePath(file).name), open(file, "rb"))) for file in path_to_file.glob('*') if not file.is_dir()]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.