honestnft_utils.ipfs
- honestnft_utils.ipfs.get_file_suffix(filename, token_id='\\\\d+')
Given a filename and an optional token_id, this function returns the file suffix. If the file has no extension, an empty string is returned.
- Return type
str- Returns
file_suffix
- Parameters
filename (
str) –token_id (
Union[int,str]) –
- honestnft_utils.ipfs.is_valid_cid(cid)
Given a CID, this function checks if it’s a valid CID.
- Parameters
cid (
str) –- Return type
bool
- honestnft_utils.ipfs.infer_cid_from_uri(URI)
Given a URI, this function returns the CID. Returns None if the CID is not found.
- Return type
Optional[str]- Returns
cid
- Parameters
URI (
str) –
- honestnft_utils.ipfs.is_valid_ipfs_uri(uri)
Given a URI, this functions checks if it’s a valid IPFS URI.
- Parameters
uri (
str) –- Return type
bool
- honestnft_utils.ipfs.fetch_ipfs_folder(collection_name, cid, parent_folder, timeout=60)
Given a collection name, a cid and an optional timeout, this function downloads the entire metadata folder from IPFS.
- Parameters
collection_name (str) – The collection name to be used as the folder name
cid (str) – The IPFS CID of folder to download
parent_folder (str) – The parent folder where the collection should be saved
timeout (int) – Connection timeout (in seconds) when connecting to the API daemon
- Return type
None
- honestnft_utils.ipfs.format_ipfs_uri(uri)
Given a IPFS URI, this function formats it with the user prefered gateway.
- Parameters
uri (
str) – The IPFS URI to be formatted- Return type
str- Returns
The formatted IPFS URI
- honestnft_utils.ipfs.is_dedicated_pinata_gateway(url)
Given a gateway, this function checks if it’s a custom Pinata gateway.
- Parameters
url (
str) –- Return type
bool