<s> import nikeplus <EOL> import logging <EOL> import sys <EOL> USER = '<STR_LIT>' <EOL> PASS = '<STR_LIT>' <EOL> ROW = "<STR_LIT>" <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> logger . setLevel ( logging . DEBUG ) <EOL> fh = logging . FileHandler ( '<STR_LIT>' ) <EOL> fh . setLevel ( logging . INFO ) <EOL> formatter = logging . Formatter ( '<STR_LIT>' ) <EOL> fh . setFormatter ( formatter ) <EOL> logger . addHandler ( fh ) <EOL> logger . info ( '<STR_LIT>' ) <EOL> np = nikeplus . NikePlus ( ) <EOL> np . Authenticate ( USER , PASS ) <EOL> logger . info ( "<STR_LIT>" . format ( i = "<STR_LIT>" , f = str ( sys . _getframe ( ) . f_code . co_name ) , m = "<STR_LIT>" . format ( t = np . token , u = USER ) ) ) <EOL> np . RetrieveAggregateData ( ) . RetrieveActivities ( ) <EOL> print ROW . format ( aid = "<STR_LIT>" , dt = "<STR_LIT>" , di = "<STR_LIT>" , du = "<STR_LIT>" , ca = "<STR_LIT>" , g = "<STR_LIT>" ) <EOL> for a in np . GetActivityIds ( ) : <EOL> npa = np . GetActivityDetails ( a ) <EOL> print ROW . format ( aid = npa . activity_id , dt = npa . start_datetime . strftime ( '<STR_LIT>' ) , di = "<STR_LIT>" . format ( npa . distance ) , du = "<STR_LIT>" . format ( d = ( npa . duration / <NUM_LIT:1000> ) ) , ca = "<STR_LIT>" . format ( c = npa . calories ) , g = npa . gps ) <EOL> logger . info ( "<STR_LIT>" . format ( i = "<STR_LIT>" , f = str ( sys . _getframe ( ) . f_code . co_name ) , m = "<STR_LIT>" . format ( a = a ) ) ) <EOL> f = open ( "<STR_LIT>" . format ( a = a ) , '<STR_LIT:w>' ) <EOL> f . write ( npa . AsJSON ( ) ) <EOL> f . close ( ) <EOL> logger . info ( "<STR_LIT>" . format ( i = "<STR_LIT>" , f = str ( sys . _getframe ( ) . f_code . co_name ) , m = "<STR_LIT>" . format ( a = a ) ) ) <EOL> f = open ( "<STR_LIT>" . format ( a = a ) , '<STR_LIT:w>' ) <EOL> f . write ( npa . AsTCX ( ) ) <EOL> f . close ( ) <EOL> logger . info ( "<STR_LIT>" . format ( i = "<STR_LIT>" , f = str ( sys . _getframe ( ) . f_code . co_name ) , m = "<STR_LIT>" . format ( a = a ) ) ) <EOL> f = open ( "<STR_LIT>" . format ( a = a ) , '<STR_LIT:w>' ) <EOL> f . write ( npa . AsGPX ( ) ) <EOL> f . close ( ) </s>
