OpenRarity / open-rarity

Reference implementation of the OpenRarity protocol with Python.
Apache License 2.0
218 stars 47 forks source link

Error when running testset_resolver #79

Closed jalagar closed 1 year ago

jalagar commented 1 year ago

Describe the bug I ran python3 -m open_rarity.resolver.testset_resolver external to try to get a test example working (not using caching) for cool-cats-nft. See output log below.

Information

To Reproduce Steps to reproduce the behavior: python3 -m open_rarity.resolver.testset_resolver external

Expected behavior A clear and concise description of what you expected to happen. It should output the rarity for cool-cats-nft

Screenshots

Executing main: with Namespace(resolve_external_rarity='external', cache_fetched_data=True, filename='test_collections.json')
Fetching collection and token trait data for: cool-cats-nft
Fetching external rarity ranks for: cool-cats-nft
Starting batch 0 for collection cool-cats-nft: Processing 293 tokens
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/testset_resolver.py", line 568, in <module>
    resolve_collection_data(
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/testset_resolver.py", line 226, in resolve_collection_data
    tokens_with_rarity: list[TokenWithRarityData] = get_tokens_with_rarity(
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/testset_resolver.py", line 151, in get_tokens_with_rarity
    external_rarity_provider.fetch_and_update_ranks(
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/rarity_providers/external_rarity_provider.py", line 483, in fetch_and_update_ranks
    self._add_rarity_sniffer_rarity_data(
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/rarity_providers/external_rarity_provider.py", line 364, in _add_rarity_sniffer_rarity_data
    token_ids_to_ranks = fetch_rarity_sniffer_rank_for_collection(
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/rarity_providers/external_rarity_provider.py", line 123, in fetch_rarity_sniffer_rank_for_collection
    tokens_to_ranks: dict[int, int] = {
  File "/Users/jamesuejio/Crypto/open-rarity/open_rarity/resolver/rarity_providers/external_rarity_provider.py", line 124, in <dictcomp>
    str(nft["id"]): int(nft["positionId"]) for nft in response.json()["data"]
TypeError: string indices must be integers

Environment

Additional context Add any other context about the problem here. I was just trying to play around and get a test example working (not using caching).

vickygos commented 1 year ago

@jalagar I just re-rank the command from latest master and could not hit error mentioned. Could you retry it after pulling latest and see if you still have an issue? One theory could be that at that moment data was not returned.

jalagar commented 1 year ago

Closing as resolved