Skip to content

Conversation

@majordoobie
Copy link
Collaborator

This update has quite a bit of change without breaking backward compatibility.

For starters, support for the context manager was added #121 allowing the use of

async def main():
	async with coc.Client() as client:
		# do stuff...

if __name__ == "__main__":
	asyncio.run(main())

Additionally, with the release of CapitalRaidSeasons we needed to improve the performance of fetching warlogs and capital raid logs. Previously, all records available from the API were fetched when in most cases, folks just needed the newest data. A limit parameter has been added to both get_warlog and get_raidlog.

Additionally, support for async for warlog has been added with the ability to fetch more data if needed.

raid_logs = await client.get_raidlog(clan_tag, page=True, limit=5)

# Set `paginate=True` to enable fetching beyond the limit value until
# there are more values to fetch
count = 0
async for i in raid_with_page:
    print(f"[{count}]-async limit: 5 page: True {i.start_time.time}")
    count += 1

This PR includes:
#122
#121
#130
#131

doluk and others added 18 commits October 10, 2022 14:03
…it clearer how the class is modifying the URL string
…he `limit` parameter to change how pagination works
…ital raids). Some documentation and testing is still needed.
… It currently seems like the API contains the but and not the code. More testing is needed
…filter is available, fix indexing in arrays if array length changes
extend Client class to work with context manager
@majordoobie majordoobie merged commit 58d280e into master Oct 24, 2022
@doluk doluk deleted the g3_doluk_iter branch January 9, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants