Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Zencoder Reports Wrapper#15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
schworer merged 5 commits intozencoder:masterfrommcos:master
Apr 5, 2013
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletionszencoder/core.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import os
import httplib2
from urllib import urlencode
from datetime import datetime

# Note: I've seen this pattern for dealing with json in different versions of
# python in a lot of modules -- if there's a better way, I'd love to use it.
Expand DownExpand Up@@ -202,6 +203,9 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
self.job = Job(*args, **kwargs)
self.account = Account(*args, **kwargs)
self.output = Output(*args, **kwargs)
self.report = None
if api_version == 'v2':
self.report = Report(*args, **kwargs)

class Response(object):
"""
Expand DownExpand Up@@ -366,3 +370,34 @@ def delete(self, job_id):
"""
return self.cancel(job_id)

class Report(HTTPBackend):
def __init__(self, *args, **kwargs):
"""
Contains all API methods relating to Reports.
"""
kwargs['resource_name'] = 'reports'
super(Report, self).__init__(*args, **kwargs)

def minutes(self, start_date=None, end_date=None, grouping=None):
"""
Gets a detailed Report of encoded minutes and billable minutes
for a date range
@param start_date: Start date of report (If not submitted,
API defaults to 30 days ago)
@param end_date: End date of report (If not submitted, API defaults to
yesterday)
@param grouping: Minute usage for only one report grouping
"""
data = {'api_key': self.api_key}
date_format = '%Y-%m-%d'
if start_date:
data['from'] = datetime.strftime(start_date, date_format)

if end_date:
data['to'] = datetime.strftime(end_date, date_format)

if grouping:
data['grouping'] = grouping

url = self.base_url + '/minutes'
return self.get(url, data=data)

[8]ページ先頭

©2009-2025 Movatter.jp