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 6b2f475

Browse filesBrowse files
author
Alex Schworer
committed
Remove references to XML
1 parent 1e824cc commit 6b2f475
Copy full SHA for 6b2f475

File tree

Expand file treeCollapse file tree

1 file changed

+8
-24
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-24
lines changed

‎zencoder/core.py

Copy file name to clipboardExpand all lines: zencoder/core.py
+8-24Lines 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
def headers(self):
6059
""" Returns default headers, by setting the Content-Type, Accepts,
6160
User-Agent and API Key headers."""
62-
content_type = 'xml' if self.as_xml else '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-
if not self.as_xml:
82-
return json.dumps(data)
83-
else:
84-
raise NotImplementedError('Encoding as XML is not supported.')
76+
return json.dumps(data)
8577

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

146138
class Zencoder(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
class Response(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
return self.get(self.base_url + '/%s' % str(output_id))
257245

258246
class Job(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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.