|
1 | 1 | importos
|
2 | 2 | importhttplib2
|
3 | 3 | fromurllibimporturlencode
|
| 4 | +fromdatetimeimportdatetime |
4 | 5 |
|
5 | 6 | # Note: I've seen this pattern for dealing with json in different versions of
|
6 | 7 | # python in a lot of modules -- if there's a better way, I'd love to use it.
|
@@ -372,21 +373,28 @@ def delete(self, job_id):
|
372 | 373 | classReport(HTTPBackend):
|
373 | 374 | def__init__(self,*args,**kwargs):
|
374 | 375 | """
|
375 |
| - Contains all API methods relating toOutputs. |
| 376 | + Contains all API methods relating toReports. |
376 | 377 | """
|
377 | 378 | kwargs['resource_name']='reports'
|
378 | 379 | super(Report,self).__init__(*args,**kwargs)
|
379 | 380 |
|
380 |
| -defdetails(self,start_date=None,end_date=None,grouping=None): |
| 381 | +defminutes(self,start_date=None,end_date=None,grouping=None): |
381 | 382 | """
|
382 |
| - Gets a detailed Report |
| 383 | + Gets a detailed Report of encoded minutes and billable minutes |
| 384 | + for a date range |
| 385 | + @param start_date: Start date of report (If not submitted, |
| 386 | + API defaults to 30 days ago) |
| 387 | + @param end_date: End date of report (If not submitted, API defaults to |
| 388 | + yesterday) |
| 389 | + @param grouping: Minute usage for only one report grouping |
383 | 390 | """
|
384 | 391 | data= {'api_key':self.api_key}
|
| 392 | +date_format='%Y-%m-%d' |
385 | 393 | ifstart_date:
|
386 |
| -data['from']=start_date |
| 394 | +data['from']=datetime.strftime(start_date,date_format).date() |
387 | 395 |
|
388 | 396 | ifend_date:
|
389 |
| -data['to']=end_date |
| 397 | +data['to']=datetime.strftime(end_date,date_format).date() |
390 | 398 |
|
391 | 399 | ifgrouping:
|
392 | 400 | data['grouping']=grouping
|
|