def main(): # data from https://dev.moves-app.com/apps client_id = '' client_secret = '' refresh_token = '' api = MovesClient( client_id=client_id, client_secret=client_secret ) access_token, refresh_token = api.refresh_oauth_token(refresh_token) print(access_token, refresh_token) api.access_token = access_token info = api.tokeninfo() print(info)
''' from moves import MovesClient from config import MOVES_CLIENT_ID, MOVES_CLIENT_SECRET, MOVES_ACCESS_TOKEN from config import MOVES_FIRST_DATE, MOVES_BACKLOG_WINDOW from datetime import date, timedelta import time import sys from calendar import monthrange import json yr_mo_str = sys.argv[1] outfile = sys.argv[2] moves = MovesClient(MOVES_CLIENT_ID, MOVES_CLIENT_SECRET) moves.access_token = MOVES_ACCESS_TOKEN [dl_yr, dl_mo] = [int(d) for d in yr_mo_str.split('-')] dl_maxdy = monthrange(dl_yr, dl_mo)[1] start_date = max(MOVES_FIRST_DATE, date(dl_yr, dl_mo, 1)) end_date = min(date(dl_yr, dl_mo, dl_maxdy), date.today()) # end_date = date.today() - timedelta(days=1) moves_data = [] dl_date = start_date # Storyline download print 'Downloading Moves storyline for %s' % yr_mo_str