Esempio n. 1
0
def getstats(config):
    st = Athlete(config.get('StravaTweet', 'rider'))
    lastride = st.rides()[0]
    if last_tweeted_id(lastride.id, config):
        return None
    else:
        return build_message(lastride, config.get('StravaTweet', 'unit'), 
            config)
Esempio n. 2
0
#!/usr/bin/env python

# Athlete is Craig Peters, employee at Strava
# http://app.strava.com/athletes/103227

from strava import Athlete

# First, we set up a Strava Object for the Athlete that we want to query
st = Athlete(103227)

# Once we've gotten the Athlete's object, we can then look at various
# statistics - number of rides and total moving time are shown below.
# By default, we only look at the last 7 days.

print('Ridden %d rides' % st.ride_stats()['rides'])
print('Total moving time: %f minutes' %
      (float(st.ride_stats()['moving_time']) / 60.0))

# We can then iterate through the rides, and further through the segments on
# each of those rides, displaying information from each. Ride details are stored
# in metric, so, we need to convert that to get imperial measurements.

for ride in st.rides():
    print('Ride name: %s' % ride.name)
    # convert from m/s to mph
    # m/s * 2.23694 = mph
    print('Average speed: %.1f mph' % (ride.detail.average_speed * 2.23694))
    print('Average watts: %d' % ride.detail.average_watts)
    for segment in ride.segments:
        print('  Segment: %s\n    Moving Time: %f minutes\n    Average '
              'Speed: %f mph' %
Esempio n. 3
0
        os.path.join(
            "/",
            os.path.dirname(os.path.dirname(os.path.dirname(os.path.join(os.path.abspath(__file__))))),
            "strava.cfg",
        )
    )
)

from strava import Athlete

"""
First, we set up a Strava Object for the Athlete that we want to query
We've done this through the Oauth2 tools located in the oauth_setup
directory.
"""
st = Athlete(access_token=config.get("user", "access_token"))

"""
Once we've gotten the Athlete's object, we can then look at various
statistics - number of activities and total moving time are shown below.
By default, we only look at the last 7 days.
"""
# stats = st.activity_stats()

# print('Ridden %d activites' % stats['activities'])
# print('Total moving time: %f minutes' %
#      (float(stats['moving_time']) / 60.0))

"""
We can then iterate through the activities, and further through the segments
on each of those activities, displaying information from each. Ride details