This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"os/user" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pickle | |
import time | |
from datetime import datetime, timedelta | |
from dotenv import load_dotenv | |
from jinja2 import Environment, FileSystemLoader | |
from stravalib.client import Client as StravaClient | |
load_dotenv() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import glob | |
csv_files = glob.glob("/*.CSV") # get list of files in directory | |
for csv_file in csv_files: # loop over all files in directory | |
data = pd.read_csv(csv_file) # load csv file | |
data = data[data["Fee"] != 0] # remove all rows where fee=0 (aka non purchases) | |
data = data[data["Gross"] > 0] # remove all rows where income < 0 (i.e. -ve) | |
data = data[['Subject', 'Gross']] # choose only subject and gross income columns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, Response, abort | |
from flask.ext.restful import Api, Resource, | |
from hashlib import sha256 | |
import hmac, redis | |
CHARGIFY_SHARED_KEY= "XYZ789" | |
REDIS_HOST="ip_address" | |
REDIS_PORT="1234" | |
FLASK_HOST="ip_address" | |
FLASK_PORT="1234" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chargify import Chargify # import this module https://github.com/hindsightlabs/chargify-python | |
CHARGIFY_API_KEY="MY_API_KEY" # insert your api key here | |
CHARGIFY_SUBDOMAIN="MY_SUBDOMAIN" # insert your subdomain here | |
chargify = Chargify(CHARGIFY_API_KEY,CHARGIFY_SUBDOMAIN) | |
def get_subscription_id_from_Chargify(email): | |
''' | |
Interface with chargify API to get their subscription_id, given a customer email address | |
''' |