Skip to content

Conversation

@BrandoDev
Copy link

This pull request introduces several improvements and updates to the brawlpy library, focusing on improving usability, code readability, and functionality. The most significant changes include the addition of an asynchronous context manager for the Client class, refactoring of code for consistency and clarity, and updates to the README.md documentation.

Enhancements to Client functionality:

  • Added asynchronous context manager methods (__aenter__ and __aexit__) to the Client class, allowing the use of async with for managing the client session lifecycle. ([brawlpy/main.pyL4-R66](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L4-R66))
  • Refactored the request method in the Client class to handle session initialization errors and improve error handling. ([brawlpy/main.pyL4-R66](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L4-R66))
  • Updated various Client methods (get_player, get_club, brawlers, events, etc.) to use consistent string formatting and improved object creation for better readability. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L40-R142), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L113-R206), [[3]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L143-R246), [[4]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L179-R284), [[5]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L211-R334), [[6]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L249-R377))

Documentation updates:

  • Updated the README.md to reflect the addition of the context manager for the Client class and corrected the installation command to point to the new repository URL. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L12-R16), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L25-R25), [[3]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R37), [[4]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R55))

Codebase cleanup and consistency:

  • Replaced single quotes with double quotes across the codebase for consistency. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-e5556f1147ae675e7061baebb2e7cddb9cc1d9006f03a765720373d6c3a2ab39L1-R3), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-2bf9fd80d007a3cb5d23139ad5bc9470436f2600e5389ca46ad74ac8cb11a833R20-R85), [[3]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L40-R142))
  • Refactored imports in brawlpy/__init__.py and brawlpy/main.py to explicitly list imported classes and objects, improving clarity and reducing wildcard imports. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-d41c6849699852c678513a728c4873b8775605d8bdc527a3023671d786dad7fcL11-R47), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L4-R66))
  • Removed unused imports and redundant code in brawlpy/errors.py and other files. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-2bf9fd80d007a3cb5d23139ad5bc9470436f2600e5389ca46ad74ac8cb11a833R10), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L4-R66))

Bug fixes and minor improvements:

  • Fixed a trailing comma issue in brawlpy/icons.py to adhere to JSON formatting standards. ([brawlpy/icons.pyL55-R55](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-fa51c3a021755e8ac61ec64529779176eb6aeb90b07ba5e2457167d09d129362L55-R55))
  • Improved error messages and handling in custom exceptions, ensuring better debugging information is provided. ([[1]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-2bf9fd80d007a3cb5d23139ad5bc9470436f2600e5389ca46ad74ac8cb11a833R20-R85), [[2]](https://github.com/PyStarr/BrawlPy/pull/4/files#diff-7cc0a1ecc2a1c7abbc754e5233bba68d768b7c92bacaa599c40be70f85c52b13L40-R142))

@BrandoDev BrandoDev marked this pull request as ready for review July 11, 2025 14:38
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.

1 participant