#!/bin/bash

set -o pipefail

echo "Setting up a virtualenv and installing dependencies"

virtualenv ./virtualenv/
. ./virtualenv/bin/activate
pip install -r requirements.txt

echo "Collecting data from the spreadsheet"

echo "{\"transactions_explorer\": {\"username\": \"$GOOGLE_USERNAME\",\"password\": \"$GOOGLE_PASSWORD\",\"key\": \"$GOOGLE_SPREADSHEET_KEY\",\"worksheet\": \"$GOOGLE_SPREADSHEET_WORKSHEET\" } }" > config.json

./backdrop-transactions-explorer-collector transactions_explorer config.json > transactions-explorer-data.json

echo "Posting data to Backdrop"

curl --fail $BACKDROP_ENDPOINT --request POST --header "Authorization: Bearer $BACKDROP_TOKEN" --header 'Content-type: application/json' --data @transactions-explorer-data.json

echo "Done."

#!/bin/bash

echo "Setting up a virtualenv and installing dependencies"

virtualenv ./virtualenv/
. ./virtualenv/bin/activate
pip install -r requirements.txt

echo "Collecting data from the spreadsheet"

echo "{\"transactions_explorer\": {\"username\": \"$GOOGLE_USERNAME\",\"password\": \"$GOOGLE_PASSWORD\",\"key\": \"$GOOGLE_SPREADSHEET_KEY\",\"worksheet\": \"$GOOGLE_SPREADSHEET_WORKSHEET\" } }" > config.json

./backdrop-transactions-explorer-collector transactions_explorer config.json > transactions-explorer-data.json

echo "Posting data to Backdrop"

curl $BACKDROP_ENDPOINT --request POST --header "Authorization: Bearer $BACKDROP_TOKEN" --header 'Content-type: application/json' --data @transactions-explorer-data.json

echo "Done."

--- 
+++ 
@@ -1,6 +1,4 @@
 #!/bin/bash
-
-set -o pipefail
 
 echo "Setting up a virtualenv and installing dependencies"
 
@@ -16,6 +14,6 @@
 
 echo "Posting data to Backdrop"
 
-curl --fail $BACKDROP_ENDPOINT --request POST --header "Authorization: Bearer $BACKDROP_TOKEN" --header 'Content-type: application/json' --data @transactions-explorer-data.json
+curl $BACKDROP_ENDPOINT --request POST --header "Authorization: Bearer $BACKDROP_TOKEN" --header 'Content-type: application/json' --data @transactions-explorer-data.json
 
 echo "Done."
Make curl fail on a non-200 status code
