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 f6381d2

Browse filesBrowse files
committed
Merge branch 'master' of https://github.com/kennedyj/zencoder-py into kennedyj-master
2 parents 1079a2c + 013ee83 commit f6381d2
Copy full SHA for f6381d2

File tree

1 file changed

+10
-6
lines changed
Filter options

1 file changed

+10
-6
lines changed

‎zencoder/core.py

Copy file name to clipboardExpand all lines: zencoder/core.py
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class HTTPBackend(object):
3131
3232
@FIXME: Build in support for supplying arbitrary backends
3333
"""
34-
def __init__(self, api_key, as_xml=False, resource_name=None, timeout=None):
34+
def __init__(self, api_key, as_xml=False, resource_name=None, timeout=None, test=False):
3535
"""
3636
Creates an HTTPBackend object, which abstracts out some of the
3737
library specific HTTP stuff.
@@ -44,6 +44,7 @@ def __init__(self, api_key, as_xml=False, resource_name=None, timeout=None):
4444
self.http = httplib2.Http(timeout=timeout)
4545
self.as_xml = as_xml
4646
self.api_key = api_key
47+
self.test = test
4748

4849
if self.as_xml:
4950
self.headers = {'Content-Type': 'application/xml',
@@ -123,7 +124,7 @@ def process(self, http_response, content):
123124

124125
class Zencoder(object):
125126
""" This is the entry point to the Zencoder API """
126-
def __init__(self, api_key=None, as_xml=False, timeout=None):
127+
def __init__(self, api_key=None, as_xml=False, timeout=None, test=False):
127128
"""
128129
Initializes Zencoder. You must have a valid API_KEY.
129130
@@ -142,8 +143,9 @@ def __init__(self, api_key=None, as_xml=False, timeout=None):
142143
else:
143144
self.api_key = api_key
144145

146+
self.test = test
145147
self.as_xml = as_xml
146-
self.job = Job(self.api_key, self.as_xml, timeout=timeout)
148+
self.job = Job(self.api_key, self.as_xml, timeout=timeout, test=self.test)
147149
self.account = Account(self.api_key, self.as_xml, timeout=timeout)
148150
self.output = Output(self.api_key, self.as_xml, timeout=timeout)
149151

@@ -221,11 +223,11 @@ class Job(HTTPBackend):
221223
"""
222224
Contains all API methods relating to transcoding Jobs.
223225
"""
224-
def __init__(self, api_key, as_xml=False, timeout=None):
226+
def __init__(self, api_key, as_xml=False, timeout=None, test=False):
225227
"""
226228
Initialize a job object
227229
"""
228-
super(Job, self).__init__(api_key, as_xml, 'jobs', timeout=timeout)
230+
super(Job, self).__init__(api_key, as_xml, 'jobs', timeout=timeout, test=test)
229231

230232
def create(self, input, outputs=None, options=None):
231233
"""
@@ -235,7 +237,9 @@ def create(self, input, outputs=None, options=None):
235237
@param outputs: a list of output dictionaries
236238
@param options: a dictionary of job options
237239
"""
238-
data = {"api_key": self.api_key, "input": input}
240+
as_test = int(self.test)
241+
242+
data = {"api_key": self.api_key, "input": input, "test": as_test}
239243
if outputs:
240244
data['outputs'] = outputs
241245

0 commit comments

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