DhanushNehru / Python-Scripts

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

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

Open Stonebanks-js opened 19 hours ago

Stonebanks-js commented 19 hours 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 19 hours ago

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