GithubHelp home page GithubHelp logo

anshulxyz / exch Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 2.0 53 KB

a command-line tool to see currency exchange rates

License: MIT License

Python 100.00%
python commandline click cli cli-app currency-exchange terminal-app terminal currency foreign-exchange-rates

exch's People

Contributors

anshulxyz avatar kxze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

exch's Issues

list currencies

Hi,

It's sometimes tough to guess the currency names, would it be possible to have a flag, for instance -l, to list currencies andtheir country ? it could be loaded from hardcoded json for offline support too.

Nb: I am currently packaging this for nixos.org

refactor some code

  • Q. Why am I using isinstance() here:
    output = fixer(base, target, amount)
    if isinstance(output, float):
        output = "{} {} = {} {}".format(amount, base, output, target)

    click.echo(output)
  • A. Because when the currency is invalid the operation is returning a string.
except KeyError:
        result = 1.00 if base == target else "KeyError: Invalid curreny"

    return result
  • Add newline at the end of the JSON files that are being written. Such as here

  • Look for a better way to handle Connection Error Exception.

  • Refactor file_handling.py

exception handling

handle exceptions such as:

  • lost internet connection
  • improper input given

put it on pypi ?

sounds like something I would use but I would rather install it from pypi
python3 -mpip install -U exch --user didn't work is it available there ?

cheers

add offline support

I shouldn't make an API call every a command is fired. That will be abusing the
free API. Running something locally will always be faster than making online
requests. So I'll save the JSON. And have the --sync option to update the
rates.

Change default currency

Currently the default are set like this:

@click.option('--base', '-b', default='USD', type=str, show_default=True,
              help='Currency you are converting from.')
@click.option('--target', '-t', default='INR', type=str, show_default=True,
              help='Currency you\'re converting to.')

Where defaults are set to USD and INR.

User should be able to change this to his preference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.