@requires('jawboneup.access_token')
def steps(gauge_factory, config, logger):
    gauge = gauge_factory('jawbone.steps')
    access_token = config['jawboneup.access_token']

    headers = {'Authorization' : 'Bearer {0}'.format(access_token)}
    r = requests.get('https://jawbone.com/nudge/api/users/@me/moves',
                     headers=headers)

    for i in range(DAYS_BACK):
        day = timedelta(days=i) - today_utc()
        resp = r.json()
        moves = resp['data']['items']
        day_date = day.date()
        today_fmt = int(day_date.strftime('%Y%m%d'))
        today_moves = filter(lambda m: m['date'] == today_fmt, moves)
        steps = sum([m['details']['steps'] for m in today_moves])

        if steps == 0:
            logger.info('Steps not found on {0}, not saving.'.format(day_date))
        else:
            gauge.save(day, steps)
            logger.info('Saved {0} steps on {1}'.format(steps, day_date))
dataset/ETHPy150Open ahmetalpbalkan/personal-dashboard/tasks/jawboneup.py/steps/swapped operands of `-`