Daily Harvest is a python app that uses Harvest's API, Mailgun, and MySQL to perform daily harvest time tracking tasks . Our web design and development company recently migrated from a custom build time tracking module in SugarCRM to Harvest. Harvest is a great time tracking tool and has a lot of nice features and integration capabilities, though it lacked a few components our company needed, such as:
- daily email reports that display totals by employee, project, and a entry
- data backups - SaaS is great when it works. And catastrophic when it fails. We need our data backed up to our MySQL database.
Enter Daily Harvest which is available for download, forking or cloning on the Daily Harvest Github Page. Currently, there are two components to Daily Harvest that address both needs mentioned above and detailed below. You can easily automate these tools by adding them to your local cron or add them as a scheduled task on iron.io.
harvest_email.py
Description:
Sends an email out to a list of receiptients with detailed timesheets as well as total hours by employee and project.
Requirements:
- Harvest Account & API Token
- Mailgun Account & API Token
- python 2.7 with libs (available via pip)
- python-dateutil
- simplejson
- requests
Install & Setup
git clone git@github.com:avatarnewyork/daily_harvest.git
cd daily_harvest
- copy and edit the following example files to the corresponding JSON files:
- harvest.json - Harvest API settings
- mailgun.json - Mailgun API settings
- recipients.json - recipient preferences
- run
python harvest_email.py
- this will connect to mailgun and send a time report based on the recipient list you provided.
Automation with iron.io worker
harvest_backup.py
Description:
Replicates the past 24 hours of punches inside a MySQL database table called "timesheet"
Requirements:
- Harvest Account & API Token
- MySQL Database with write access from your executing python client.
- python 2.7 with libs (available via pip)
- python-dateutil
- simplejson
- mysql-connector-python
Install & Setup
git clone git@github.com:avatarnewyork/daily_harvest.git
cd daily_harvest
- create a new database and associated credentials
- install the mysql schema file
harvest_backup.sql
on the database you created above. This will create a database table calledtimesheet
- copy and edit the following example files to the corresponding JSON files:
- harvest.json - Harvest API settings
- mysql.json - MySQL settings
- run
python harvest_backup.py
- this will connect to your mysql database and insert all time entries added to harvest in the past 24 hours.
Automation
Resources
- Daily Harvest - Github Project Page
- Harvest Python API - forked github module. Original source and credit go to @lann/Harvest
- Harvestapp
- Mailgun
- MySQL
- Avatar New York