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

Commit6b2f475

Browse files
author
Alex Schworer
committed
Remove references to XML
1 parent1e824cc commit6b2f475

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

‎zencoder/core.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def __init__(self,
4747

4848
self.http=requests.Session()
4949

50-
self.as_xml=False
5150
self.api_key=api_key
5251
self.test=test
5352
self.version=version
@@ -59,11 +58,10 @@ def __init__(self,
5958
defheaders(self):
6059
""" Returns default headers, by setting the Content-Type, Accepts,
6160
User-Agent and API Key headers."""
62-
content_type='xml'ifself.as_xmlelse'json'
6361

6462
headers= {
65-
'Content-Type':'application/{0}'.format(content_type),
66-
'Accept':'application/{0}'.format(content_type),
63+
'Content-Type':'application/json',
64+
'Accept':'application/json',
6765
'Zencoder-Api-Key':self.api_key,
6866
'User-Agent':'zencoder-py v{0}'.format(LIB_VERSION)
6967
}
@@ -74,14 +72,8 @@ def encode(self, data):
7472
"""
7573
Encodes data as JSON (by calling `json.dumps`), so that it can be
7674
passed onto the Zencoder API.
77-
78-
.. note::
79-
Encoding as XML is not supported.
8075
"""
81-
ifnotself.as_xml:
82-
returnjson.dumps(data)
83-
else:
84-
raiseNotImplementedError('Encoding as XML is not supported.')
76+
returnjson.dumps(data)
8577

8678
defdelete(self,url,params=None):
8779
"""
@@ -145,7 +137,7 @@ def process(self, response):
145137

146138
classZencoder(object):
147139
""" This is the entry point to the Zencoder API """
148-
def__init__(self,api_key=None,api_version=None,as_xml=False,timeout=None,test=False):
140+
def__init__(self,api_key=None,api_version=None,timeout=None,test=False):
149141
"""
150142
Initializes Zencoder. You must have a valid `api_key`.
151143
@@ -171,9 +163,8 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
171163
self.api_key=api_key
172164

173165
self.test=test
174-
self.as_xml=as_xml
175166

176-
args= (self.base_url,self.api_key,self.as_xml)
167+
args= (self.base_url,self.api_key)
177168
kwargs=dict(timeout=timeout,test=self.test,version=api_version)
178169
self.job=Job(*args,**kwargs)
179170
self.account=Account(*args,**kwargs)
@@ -183,10 +174,7 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
183174
self.report=Report(*args,**kwargs)
184175

185176
classResponse(object):
186-
"""
187-
The Response object stores the details of an API request in an XML/JSON
188-
agnostic way.
189-
"""
177+
""" The Response object stores the details of an API request. """
190178
def__init__(self,code,body,raw_body,raw_response):
191179
self.code=code
192180
self.body=body
@@ -256,13 +244,9 @@ def details(self, output_id):
256244
returnself.get(self.base_url+'/%s'%str(output_id))
257245

258246
classJob(HTTPBackend):
259-
"""
260-
Contains all API methods relating to transcoding Jobs.
261-
"""
247+
""" Contains all API methods relating to transcoding Jobs. """
262248
def__init__(self,*args,**kwargs):
263-
"""
264-
Initializes a job object
265-
"""
249+
""" Initializes a job object. """
266250
kwargs['resource_name']='jobs'
267251
super(Job,self).__init__(*args,**kwargs)
268252

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp