DhanushNehru / Python-Scripts

A curated list of python scripts for automating your tasks
https://dhanushnehru.github.io/Python-Scripts/
MIT License
558 stars 262 forks source link

Add Error Handling, Input Validation, and Offline Mode with Caching #344

Closed Stonebanks-js closed 1 month ago

Stonebanks-js commented 1 month ago

Description:

We need to enhance the functionality of the currency conversion script by:

  • Implementing proper error handling for invalid inputs, network failures, or API errors.
  • Adding input validation to ensure correct currency codes and numerical values are provided.
  • Extending the cache mechanism to allow for offline mode by storing conversion rates locally.

Feature Details:

Error Handling:

Input Validation:

  • Ensure currency codes are three-letter strings (ISO format).
  • Validate that the amount entered is a positive integer or float.

Offline Mode with Cache:

  • Store the exchange rates in a local file after the first API call.
  • Use the cached file for future conversions when offline or if the API fails.

Steps that I will perform :

Stonebanks-js commented 1 month ago

@DhanushNehru Assign this task to me and add @hacktoberfest-accepted label