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

Commit8036f3a

Browse files
committed
Adding support for the test flag
1 parentcc63577 commit8036f3a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎zencoder/core.py

Lines changed: 12 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
ifself.as_xml:
4950
self.headers= {'Content-Type':'application/xml',
@@ -123,7 +124,7 @@ def process(self, http_response, content):
123124

124125
classZencoder(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
defcreate(self,input,outputs=None,options=None):
231233
"""
@@ -235,7 +237,11 @@ 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=0
241+
if (self.test):
242+
as_test=1
243+
244+
data= {"api_key":self.api_key,"input":input,"test":as_test}
239245
ifoutputs:
240246
data['outputs']=outputs
241247

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp