@@ -47,7 +47,6 @@ def __init__(self,
47
47
48
48
self.http = requests.Session()
49
49
50
- self.as_xml = False
51
50
self.api_key = api_key
52
51
self.test = test
53
52
self.version = version
@@ -59,11 +58,10 @@ def __init__(self,
59
58
def headers(self):
60
59
""" Returns default headers, by setting the Content-Type, Accepts,
61
60
User-Agent and API Key headers."""
62
- content_type = 'xml' if self.as_xml else 'json'
63
61
64
62
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' ,
67
65
'Zencoder-Api-Key': self.api_key,
68
66
'User-Agent': 'zencoder-py v{0}'.format(LIB_VERSION)
69
67
}
@@ -74,14 +72,8 @@ def encode(self, data):
74
72
"""
75
73
Encodes data as JSON (by calling `json.dumps`), so that it can be
76
74
passed onto the Zencoder API.
77
-
78
- .. note::
79
- Encoding as XML is not supported.
80
75
"""
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)
85
77
86
78
def delete(self, url, params=None):
87
79
"""
@@ -145,7 +137,7 @@ def process(self, response):
145
137
146
138
class Zencoder(object):
147
139
""" 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):
149
141
"""
150
142
Initializes Zencoder. You must have a valid `api_key`.
151
143
@@ -171,9 +163,8 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
171
163
self.api_key = api_key
172
164
173
165
self.test = test
174
- self.as_xml = as_xml
175
166
176
- args = (self.base_url, self.api_key, self.as_xml )
167
+ args = (self.base_url, self.api_key)
177
168
kwargs = dict(timeout=timeout, test=self.test, version=api_version)
178
169
self.job = Job(*args, **kwargs)
179
170
self.account = Account(*args, **kwargs)
@@ -183,10 +174,7 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
183
174
self.report = Report(*args, **kwargs)
184
175
185
176
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. """
190
178
def __init__(self, code, body, raw_body, raw_response):
191
179
self.code = code
192
180
self.body = body
@@ -256,13 +244,9 @@ def details(self, output_id):
256
244
return self.get(self.base_url + '/%s' % str(output_id))
257
245
258
246
class Job(HTTPBackend):
259
- """
260
- Contains all API methods relating to transcoding Jobs.
261
- """
247
+ """ Contains all API methods relating to transcoding Jobs. """
262
248
def __init__(self, *args, **kwargs):
263
- """
264
- Initializes a job object
265
- """
249
+ """ Initializes a job object. """
266
250
kwargs['resource_name'] = 'jobs'
267
251
super(Job, self).__init__(*args, **kwargs)
268
252