项目作者: melizeche

项目描述 :
Checks USD/PYG exchange rate from several sites, with a calculator, RESTful API and a twitter bot
高级语言: HTML
项目地址: git://github.com/melizeche/dolarPy.git
创建时间: 2015-08-25T20:34:33Z
项目社区:https://github.com/melizeche/dolarPy

开源协议:Apache License 2.0

下载


dolarPy

Checks USD/PYG exchange rate from several sites, with a calculator, RESTful API and a twitter bot

  • Scraper: Checks USD/PYG exchange rate from several sites every 10 minutes, saves the info in a json file
  • Webservice: Flask app to serve the API and display the main website with the calculator
  • TwitterBot: Reads the webservice output and tweet it(in a human readable format)

DEMO/Webservice

http://dolar.melizeche.com/api/1.0/

Twitter Bot

https://twitter.com/DolarPy

Mobile

API wrappers

Documentation in progress

Requirements

  • Python 2.7+ or 3.5+
  • BeautifulSoup4
  • Flask
  • Tweepy

Install

  1. git clone git@github.com:melizeche/dolarPy.git
  2. cd dolarPy
  3. python3 -m venv env
  4. # if venv module is not installed install with `sudo apt install python3-venv`
  5. source env/bin/activate
  6. pip install -r requirements.txt
  7. crontab -e (add coti.py) // See example below
  8. python cotiapp.py

On macOS High Sierra with python3 (also most linux distros)

  1. # pip3 is installed with Python3
  2. pip3 install virtualenv
  3. # creating the virtualenv
  4. virtualenv -p python3 env
  5. # activate the virtualenv:
  6. source env/bin/activate
  7. pip3 install -r requirements.txt
  8. # and the run
  9. # if you need to deactivate the virtualenv:
  10. deactivate

Crontab format and example

MIN HOUR DAYofMONTH MONTH DAYofWEEK PYTHONPATH SCRIPT

So for check/update the exchange rate every 10 minutes between 6am and 8pm on weekdays

*/10 6-20 * * 1-5 /apps/dolarPy/env/bin/python /apps/dolarPy/coti.py

And for tweet the exchange rate at 8am, 12pm and 6pm on weekdays

0 8,12,18 * * 1-5 /apps/dolarPy/env/bin/python /apps/dolarPy/single_tweet_bot.py

Contributing

If it is a new feature, before contributing, open an issue and ask if your functionality is needed by the project.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

Contributors / Thanks

TODO(APIv2)

  • ~Better~ Documentation
  • Add more currencies
  • Databases support
  • Historical data API endpoint

License

This project is licensed under the Apache 2.0 License - see the LICENSE.txt file for details