acmpesuecc/Consoles_India_StockNotifier
Refactor Configuration files to External Config File
Open
#2 opened on Oct 17, 2024
Bounty: 50good first issue
Repository metrics
- Stars
- (0 stars)
- PR merge metrics
- (PR metrics pending)
Description
Currently, the main config, product and website configurations are hardcoded, making it difficult to manage and update. We should refactor this into a separate configuration file to improve maintainability, reduce clutter in the code, and allow for easier updates in the future.
Proposed Solution:
- Create an external configuration file (e.g., config.yaml) to store product information.
- Modify the Python code to load product details from these configuration file instead of hardcoding them in the Python file.
Files to be refactored
- Scrapper Config Scrapper settings
- Product Config Each product info
- Website Config Each website info
- main.py Products to check for
- Website Configuration has headers for each website. Extract this into a separate configuration file.
- Website Configuration for Amazon has wishlist products. Separate WebsiteConfig and Wishlist Products. (e.g., One solution could be making Amazon Wishlist a separate website with it's own product config.)
Steps to Implement:
- Create a new configuration file (e.g., products_config.yaml and website_config.yaml).
- Move all product/website data into this configuration file.
- Modify the existing Python file to parse and load the configuration at runtime.
- Test to ensure that functionality remains the same and all products are correctly loaded from the configuration file.
Additional Considerations:
- Ensure that the configuration file format is easy to update.
- Document the new configuration file format and explain how to add or update products.
Benefits:
- Improved maintainability.
- Reduced code duplication.
- Easier to update or add new products without modifying Python code directly.