Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eede4fa

Browse filesBrowse files
author
Mark Costello
committed
Changes to reporting - pass in a start and end date in datetime format
1 parent 475b185 commit eede4fa
Copy full SHA for eede4fa

File tree

Expand file treeCollapse file tree

1 file changed

+13
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-5
lines changed

‎zencoder/core.py

Copy file name to clipboardExpand all lines: zencoder/core.py
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import httplib2
33
from urllib import urlencode
4+
from datetime import datetime
45

56
# Note: I've seen this pattern for dealing with json in different versions of
67
# 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):
372373
class Report(HTTPBackend):
373374
def __init__(self, *args, **kwargs):
374375
"""
375-
Contains all API methods relating to Outputs.
376+
Contains all API methods relating to Reports.
376377
"""
377378
kwargs['resource_name'] = 'reports'
378379
super(Report, self).__init__(*args, **kwargs)
379380

380-
def details(self, start_date=None, end_date=None, grouping=None):
381+
def minutes(self, start_date=None, end_date=None, grouping=None):
381382
"""
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
383390
"""
384391
data = {'api_key': self.api_key}
392+
date_format = '%Y-%m-%d'
385393
if start_date:
386-
data['from'] = start_date
394+
data['from'] = datetime.strftime(start_date, date_format).date()
387395

388396
if end_date:
389-
data['to'] = end_date
397+
data['to'] = datetime.strftime(end_date, date_format).date()
390398

391399
if grouping:
392400
data['grouping'] = grouping

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.