@@ -163,7 +163,7 @@ def send_heartbeats(heartbeats, args, configs, use_ntlm_proxy=False):
163163 return AUTH_ERROR if code == 401 else API_ERROR
164164
165165
166- def get_coding_time ( start , end , args , use_ntlm_proxy = False ):
166+ def get_time_today ( args , use_ntlm_proxy = False ):
167167 """Get coding time from WakaTime API for given time range.
168168
169169 Returns total time as string or `None` when unable to fetch summary from
@@ -207,8 +207,8 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
207207 ssl_verify = args .ssl_certs_file
208208
209209 params = {
210- 'start' : start ,
211- 'end' : end ,
210+ 'start' : 'today' ,
211+ 'end' : 'today' ,
212212 }
213213
214214 # send request to api
@@ -219,7 +219,7 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
219219 verify = ssl_verify )
220220 except RequestException :
221221 if should_try_ntlm :
222- return get_coding_time ( start , end , args , use_ntlm_proxy = True )
222+ return get_time_today ( args , use_ntlm_proxy = True )
223223
224224 session_cache .delete ()
225225 if log .isEnabledFor (logging .DEBUG ):
@@ -228,12 +228,12 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
228228 'traceback' : traceback .format_exc (),
229229 }
230230 log .error (exception_data )
231- return '{}: {}' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
231+ return '{0 }: {1 }' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
232232 return None , API_ERROR
233233
234234 except : # delete cached session when requests raises unknown exception
235235 if should_try_ntlm :
236- return get_coding_time ( start , end , args , use_ntlm_proxy = True )
236+ return get_time_today ( args , use_ntlm_proxy = True )
237237
238238 session_cache .delete ()
239239 if log .isEnabledFor (logging .DEBUG ):
@@ -242,7 +242,7 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
242242 'traceback' : traceback .format_exc (),
243243 }
244244 log .error (exception_data )
245- return '{}: {}' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
245+ return '{0 }: {1 }' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
246246 return None , API_ERROR
247247
248248 code = response .status_code if response is not None else None
@@ -260,19 +260,19 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
260260 'traceback' : traceback .format_exc (),
261261 }
262262 log .error (exception_data )
263- return '{}: {}' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
263+ return '{0 }: {1 }' .format (sys .exc_info ()[0 ].__name__ , u (sys .exc_info ()[1 ])), API_ERROR
264264 return None , API_ERROR
265265 else :
266266 if should_try_ntlm :
267- return get_coding_time ( start , end , args , use_ntlm_proxy = True )
267+ return get_time_today ( args , use_ntlm_proxy = True )
268268
269269 session_cache .delete ()
270270 log .debug ({
271271 'response_code' : code ,
272272 'response_text' : content ,
273273 })
274274 if log .isEnabledFor (logging .DEBUG ):
275- return 'Error: {}' .format (code ), API_ERROR
275+ return 'Error: {0 }' .format (code ), API_ERROR
276276 return None , API_ERROR
277277
278278
0 commit comments