Hi,
I’m attempting to collect NFT’s owner_hash and decode it to get the xch address.
I used Spacescan’s NFT API but seems like there is some issue in calling all of the NFTs. It seems to only call on partial of the NFTs in the collection.
I’m curious to know if there is another way around to pulling the complete data from an NFT collection.
Don’t think there is anything wrong with my code, just incase this is what im running;
from time import sleep
import json
import requests
import time
chamster_url = f'https://api2.spacescan.io/api/nft/collection/col1hn3a9j6pgxtel9nl7duxatc0hk2w5e27leze3r34h46qptnyesms04rcac?coin=xch&version=v0.1'
r = requests.get(chamster_url)
chamster_json = r.json()
owner_hash = chamster_json['data']
chamster_count = (len(chamster_json['data']))
results = []
print(f'There are {chamster_count} NFTs in this API database. Saving owner_hash values to json file in current directory')
for hash in owner_hash:
owner_hashes = hash['owner_hash']
owner_number = hash['meta_info']['name']
print(owner_hashes, owner_number)
data = {
'owner_hash':owner_hashes,
'name': owner_number,
}
results.append(data)
time.sleep(r.elapsed.total_seconds())
with open('hash_info.json', 'w') as f:
json.dump(results, f, indent = 2)
Thanks -