mirror of
https://github.com/langgenius/dify-plugins.git
synced 2026-07-22 01:55:36 -04:00
[PR #782] [CLOSED] Refactor Financial Datasets API integration #ieeesoc #1169
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-plugins/pull/782
Author: @anu-rrn1
Created: 6/26/2025
Status: ❌ Closed
Base:
main← Head:Refactor-Financial-Datasets-API-Integration📝 Commits (1)
29c4d32Refactor Financial Datasets API integration with structured error handling and modular request methods📊 Changes
1 file changed (+187 additions, -0 deletions)
View changed files
➕
FinancialAI/financialdatasets/tools/base.py(+187 -0)📄 Description
…dling and modular request methods
Plugin Submission Form
1. Metadata
2. Submission Type
3. Description
Refactored the Financial Datasets API wrapper for improved code modularity, error handling, and type safety. Introduced a unified internal request handler to reduce code duplication across GET and POST methods.
Changes Made:
✅ Introduced a centralized _send_request() method supporting both GET and POST operations.
✅ Enhanced HTTP response validation via _is_request_successful() and _handle_api_response() functions.
✅ Replaced generic Exception handling with a custom FinancialDatasetsAPIError class.
✅ Filtered out None values from query parameters to prevent malformed API requests.
✅ Added stricter type annotations using Optional, Enum, and Dict[str, Any].
✅ Updated docstrings for improved clarity and developer experience.
✅ Preserved backward-compatible http_get() and http_post() interfaces.
Benefits:
Better separation of concerns and error traceability.
Promotes code reuse and cleaner request management.
Easier to maintain, extend, and debug.
4. Checklist
5. Documentation Checklist
Please confirm that your plugin README includes all necessary information:
6. Privacy Protection Information
Based on Dify Plugin Privacy Protection Guidelines:
Data Collection
Privacy Policy
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.