Skip to content

Error Handling Enhancements #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

alejandro-gonzalez-scale
Copy link
Contributor

@alejandro-gonzalez-scale alejandro-gonzalez-scale commented Sep 27, 2023

Description

This pull request introduces several improvements and enhancements to the existing Python script. The key changes are outlined below:

Enhanced Error Handling

  • The error handling logic has been improved in the _api_request method. Specifically, when encountering a 409 HTTP status code and specific conditions are met (endpoint contains "task" and body contains a "unique_id"), the code checks for retry history and performs additional API requests to retrieve task data if necessary.

Readability and Maintenance

  • The code has been refactored to enhance readability and maintainability. Descriptive variable names have been used, and comments have been added to explain each step of the process.

Version Update

  • The version number in the _version.py file has been updated from "2.14.4" to "2.15.0," and the package name remains "scaleapi."

Miscellaneous

  • Minor adjustments have been made to variable naming and code structure to align with Python naming conventions and improve overall code quality.

How to Test

To test these changes, you can use the modified script in your existing project or application. Be sure to provide a valid API key when initializing the Api class.

Additional Information

  • The script remains backward-compatible with the original version.
  • These changes are designed to enhance error handling and make the code more robust when dealing with specific API responses.
  • We have maintained consistency with the existing coding style and conventions.

Please review and merge this pull request to incorporate these improvements into the project.

Copy link
Contributor

@fatihkurtoglu fatihkurtoglu left a comment

Choose a reason for hiding this comment

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

lgtm, will you also add the logic for "API Key Validation" in this PR? (it's mentioned in the PR description)

@alejandro-gonzalez-scale alejandro-gonzalez-scale merged commit b5815c3 into master Sep 27, 2023
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.

2 participants