espin086 / espin086/jjutils

Create a Modern Python Class for API Data Retrieval

Open
#25 0 comments 0 reactions 1 assignee Claimed by @espin086 View on GitHub
Dominant language
Python
Stars
2
Forks
0
Avg merge
1m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.