Skip to content
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

Create a Modern Python Class for API Data Retrieval #25

Open
espin086 opened this issue Jun 9, 2024 · 0 comments
Open

Create a Modern Python Class for API Data Retrieval #25

espin086 opened this issue Jun 9, 2024 · 0 comments
Assignees

Comments

@espin086
Copy link
Owner

espin086 commented Jun 9, 2024

We need to create a modern Python class that can retrieve data from APIs using pull requests. This class should be designed with best practices in mind to ensure efficiency, readability, and maintainability.

Here are some best practices to consider:

  1. Use of Requests Library: The Requests library is a simple yet powerful HTTP library for Python, which can be used to send HTTP requests. It should be used for making the API calls.

  2. Error Handling: The class should have robust error handling to manage potential issues that may arise during the API call, such as timeouts, connection errors, and HTTP errors.

  3. Rate Limiting: If the API has a rate limit, the class should be able to handle it gracefully. This could be achieved by adding delays or using a backoff strategy.

  4. Authentication: If the API requires authentication, the class should provide a secure way to handle this. Avoid hardcoding credentials in the code.

  5. Logging: Implement logging to track the API calls and their responses. This will be helpful for debugging and monitoring purposes.

  6. Unit Testing: The class should be covered by unit tests to ensure its functionality and to prevent regressions in the future.

  7. Documentation: Each method in the class should be well-documented. The documentation should explain what the method does, its parameters, its return value, and any exceptions it might raise.

  8. Modularity: The class should be designed in a way that it can be easily extended or modified in the future. This can be achieved by following principles like Single Responsibility and Open-Closed from SOLID principles.

Please feel free to add any other best practices that you think should be considered while creating this class.

@espin086 espin086 self-assigned this Jun 9, 2024
@espin086 espin086 changed the title **Create a Modern Python Class for API Data Retrieval** Create a Modern Python Class for API Data Retrieval Jun 9, 2024
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

No branches or pull requests

1 participant