Skip to content

Refactor Nintendo Parental Control Library#54

Merged
pantherale0 merged 3 commits into
mainfrom
break/migrate-to-pynintendoauth
Nov 4, 2025
Merged

Refactor Nintendo Parental Control Library#54
pantherale0 merged 3 commits into
mainfrom
break/migrate-to-pynintendoauth

Conversation

@pantherale0
Copy link
Copy Markdown
Owner

Enhance code readability and consistency by refactoring the Nintendo Parental Control Library. Replace the Authenticator module with a new implementation using a new library called pynintendoauth, improve error handling and logging, and streamline player management. Update requirements and align the test script with the new authentication flow.

This is a breaking change as the authenticator is initialized differently. There is no backwards compatible functions.

- Updated Application class for improved code readability and consistency.
- Removed the Authenticator module and replaced it with a new implementation using pynintendoauth.
- Deleted unused constants related to authentication.
- Enhanced Device class with better logging and error handling.
- Updated exception handling to streamline error management.
- Improved player management within the Player class.
- Added utility functions for better async handling.
- Updated requirements to include pynintendoauth.
- Refactored test script to align with new authentication flow.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 4, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
pip/pynintendoauth UnknownUnknown
pip/pynintendoauth ~> 1.0.0 UnknownUnknown

Scanned Files

  • requirements.txt
  • setup.py

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @pantherale0, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring of the Nintendo Parental Control Library, primarily by externalizing the authentication mechanism. The previous custom Authenticator has been replaced with an integration of the pynintendoauth library, leading to a more robust and maintainable authentication flow. This change impacts how the library handles API requests and requires updates to its dependencies and usage patterns, including the test script.

Highlights

  • Authentication Refactor: The custom Authenticator module has been entirely replaced by a new implementation that leverages the external pynintendoauth library, significantly streamlining authentication logic.
  • New Dependency: The pynintendoauth library has been added as a new dependency, centralizing the handling of Nintendo authentication flows.
  • Simplified API Requests: The Api class now delegates authenticated HTTP requests to the new Authenticator, reducing internal complexity and improving consistency.
  • Breaking Change: This refactoring introduces a breaking change, as the authenticator is now initialized differently, with no backwards compatible functions.
  • Improved Error Handling: HTTP-related exceptions are now imported directly from pynintendoauth.exceptions, simplifying the internal exception structure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pantherale0 pantherale0 added breaking-change enhancement New feature or request labels Nov 4, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant refactoring of the Nintendo Parental Control Library. It replaces the custom authentication logic with the pynintendoauth library, which greatly simplifies the codebase and improves maintainability. The changes also include updating exception handling to use exceptions from the new library, updating dependencies, and applying numerous formatting fixes that enhance code readability and style consistency. The test script is also correctly updated to align with the new authentication flow. This is a solid improvement to the library. I have one comment regarding a potential IndexError due to unsafe list access.

Comment thread pynintendoparental/player.py
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @pantherale0, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring of the Nintendo Parental Control Library, primarily focusing on enhancing maintainability and consistency. The most impactful change is the complete migration of the authentication mechanism to the external pynintendoauth library, which centralizes and streamlines the authentication flow. This change is breaking, as the Authenticator module's initialization and usage have been fundamentally altered, necessitating updates for any code that interacts with it. Additionally, the PR includes general code cleanup and improved error handling by leveraging the new authentication library's exception types.

Highlights

  • Authentication System Overhaul: The custom authentication logic has been completely replaced by the pynintendoauth library, centralizing authentication responsibilities and removing a significant amount of boilerplate code.
  • Simplified Error Handling: Exceptions related to HTTP and OAuth are now imported and managed by the pynintendoauth library, reducing redundant local exception definitions and improving consistency.
  • Enhanced Code Readability and Consistency: Numerous files have undergone minor formatting adjustments and code cleanup to improve overall consistency and readability across the library.
  • Breaking Change in Authenticator Initialization: The initialization of the Authenticator module has changed significantly, requiring updates to any consuming code due to the new underlying authentication mechanism.
  • Streamlined API Requests: The Api class now leverages the pynintendoauth library's async_authenticated_request method for all authenticated API calls, simplifying the request sending process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the authentication mechanism by replacing the internal implementation with the pynintendoauth library. This is a significant improvement, simplifying the codebase and delegating authentication to a specialized library. The changes are mostly well-executed, with corresponding updates to the API client and test script. However, I've identified a critical issue where the token refresh logic has been removed, which will cause the library to fail after a token expires. I've also included a couple of medium-severity suggestions to improve dependency management and the robustness of the test script.

Comment thread pynintendoparental/api.py
Comment thread setup.py Outdated
Comment thread test.py Outdated
pantherale0 and others added 2 commits November 4, 2025 16:26
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@pantherale0 pantherale0 merged commit ddd224f into main Nov 4, 2025
3 checks passed
@pantherale0 pantherale0 deleted the break/migrate-to-pynintendoauth branch December 8, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant