cgrok / clashroyale

Async + Sync wrapper for royaleapi.com and the CR official API
MIT License
47 stars 19 forks source link

Iterating through object returns more than limit. #38

Open astranberg opened 4 years ago

astranberg commented 4 years ago

Hello,

Not sure what's happening but the object returned from get_top_clans seems to bug when iterated through. When I print the object, I get this single item I requested (limit=1). But when I iterate through it I get a near infinite loop of objects.

CODE

officialClient = clashroyale.official_api.Client(officialAPIToken)
lTopClans = officialClient.get_top_clans(limit=1)
print('Number of Clans:', len(lTopClans))
for i in lTopClans:
    print(i.tag)

EXPECTED:

Number of Clans: 1
#GYUQQCLV

ACTUAL:

Number of Clans: 1
#GYUQQCLV
#GYUQQCLV
#2CLV2RP0
#GYUQQCLV
#2CLV2RP0
#2GGR2GPQ0
#GYUQQCLV
#2CLV2RP0
#2GGR2GPQ0
#2LJ0ULYCC
#GYUQQCLV
#2CLV2RP0
#2GGR2GPQ0
#2LJ0ULYCC
#GUPYJ2

You'll see there's actually a pattern to it: it's returning like this:

item1
item1
item2
item1
item2
item3
item1
item2
item3
item4

But obviously, it was only supposed to return 1 item altogether.