Skip to content

Commit

Permalink
Merge pull request #3 from PABourdais/improve
Browse files Browse the repository at this point in the history
Add error if wrong ticker + refactoring
  • Loading branch information
PABourdais committed Nov 17, 2022
2 parents b4e04cf + fee323f commit d03b4ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ https://github.com/PaulHendi/ELROND-LKMEX-AIRDROP

<p align="center" >
<img src="https://user-images.githubusercontent.com/23435882/169236163-2ed5bd72-df97-4865-aa28-bf2695e52e43.png"><br>
<b>Maid with ❤️ by Elrond Buddies</b>
<b>Made with ❤️ by Elrond Buddies</b>
</p>
44 changes: 22 additions & 22 deletions get-nfts-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import csv
import requests
import time
import sys

from datetime import datetime
from pathlib import Path
Expand Down Expand Up @@ -36,12 +37,18 @@
all_wallet = []
current_date = datetime.now()

if args.trait_type and args.name:
i = 0
while i < 10000:
nfts = requests.get(f'https://api.elrond.com/collections/{nft_collection_name}/nfts?from=' + str(
i) + '&size=100&withOwner=true').json()
for nft in nfts:
i = 0
while i < 10000:
nfts = requests.get(f'https://api.elrond.com/collections/{nft_collection_name}/nfts?from=' + str(
i) + '&size=100&withOwner=true').json()
try:
if nfts['message'] == 'Validation failed for argument \'collection\': Invalid collection identifier.':
print(f'Collection {nft_collection_name} does not exist\n')
sys.exit()
except:
pass
for nft in nfts:
if args.trait_type and args.name:
try:
for item_query in nft['metadata']['attributes']:
if args.trait_type == item_query['trait_type'] and args.name == item_query['value']:
Expand All @@ -50,29 +57,21 @@
all_wallet.append(nft["owner"])
except:
pass
time.sleep(0.09)
i = i + 100

# files name
txt_file = current_date.strftime(f"%b-%d-%Y-{nft_collection_name}-{args.name}.txt")
result_csv = current_date.strftime(f"output/%b-%d-%Y-{nft_collection_name}-{args.name}")

else:
i = 0
while i < 10000:
nfts = requests.get(f'https://api.elrond.com/collections/{nft_collection_name}/nfts?from=' + str(
i) + '&size=100&withOwner=true').json()
for nft in nfts:
else:
try:
if nft["owner"] not in single_wallet:
single_wallet.append(nft["owner"])
all_wallet.append(nft["owner"])
except:
pass
time.sleep(0.09)
i = i + 100
time.sleep(0.09)
i = i + 100

# files name
# files name
if args.trait_type and args.name:
txt_file = current_date.strftime(f"%b-%d-%Y-{nft_collection_name}-{args.name}.txt")
result_csv = current_date.strftime(f"output/%b-%d-%Y-{nft_collection_name}-{args.name}")
else:
txt_file = current_date.strftime(f"%b-%d-%Y-{nft_collection_name}.txt")
result_csv = current_date.strftime(f"output/%b-%d-%Y-{nft_collection_name}")

Expand Down Expand Up @@ -112,3 +111,4 @@
print(f'Number of wallets: {len(values)}')
print(f'Number of NFTs: {total_nft}\n')
print(f'Average Nbr of NFTs per wallet {average}\n')
print(f'\n----- Made by ElrondBuddies <3 -----\n')

0 comments on commit d03b4ad

Please sign in to comment.