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 774937f

Browse filesBrowse files
committed
reshuffling things
1 parent a1cc2d3 commit 774937f
Copy full SHA for 774937f

File tree

Expand file treeCollapse file tree

1 file changed

+49
-50
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+49
-50
lines changed

‎zencoder/zencoder.py

Copy file name to clipboardExpand all lines: zencoder/zencoder.py
+49-50Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,61 @@ def __init__(self, api_key=None, as_xml=False):
132132
self.output = Output(self.api_key, self.as_xml)
133133

134134
class Response(object):
135-
""" Response object """
135+
"""
136+
The Response object stores the details of an API request in an XML/JSON
137+
agnostic way.
138+
"""
136139
def __init__(self, code, body, raw_body, raw_response):
137140
self.code = code
138141
self.body = body
139142
self.raw_body = raw_body
140143
self.raw_response = raw_response
141144

145+
class Account(HTTPBackend):
146+
""" Account object """
147+
def __init__(self, api_key=None, as_xml=False):
148+
"""
149+
Initializes an Account object
150+
"""
151+
super(Account, self).__init__(api_key, as_xml, 'account')
152+
153+
def create(self, email, tos=True, options=None):
154+
"""
155+
Creates an account with Zencoder, no API Key necessary.
156+
"""
157+
data = {'email': email,
158+
'terms_of_service': int(tos)}
159+
if options:
160+
data.update(options)
161+
162+
return self.post(self.base_url, body=self.encode(data))
163+
164+
def details(self):
165+
"""
166+
Gets your account details.
167+
"""
168+
data = {'api_key': self.api_key}
169+
170+
return self.get(self.base_url, params=urlencode(data))
171+
172+
def integration(self):
173+
"""
174+
Puts your account into integration mode.
175+
"""
176+
data = {'api_key': self.api_key}
177+
178+
return self.get(self.base_url + '/integration',
179+
params=urlencode(data))
180+
181+
def live(self):
182+
"""
183+
Puts your account into live mode."
184+
"""
185+
data = {'api_key': self.api_key}
186+
187+
return self.get(self.base_url + '/live',
188+
params=urlencode(data))
189+
142190
class Output(HTTPBackend):
143191
""" Gets information regarding outputs """
144192
def __init__(self, api_key, as_xml=False):
@@ -215,52 +263,3 @@ def delete(self, job_id):
215263
"""
216264
pass
217265

218-
class Notification(object):
219-
""" Notification object """
220-
pass
221-
222-
class Account(HTTPBackend):
223-
""" Account object """
224-
def __init__(self, api_key=None, as_xml=False):
225-
"""
226-
Initializes an Account object
227-
"""
228-
super(Account, self).__init__(api_key, as_xml, 'account')
229-
230-
def create(self, email, tos=True, options=None):
231-
"""
232-
Creates an account with Zencoder, no API Key necessary.
233-
"""
234-
data = {'email': email,
235-
'terms_of_service': int(tos)}
236-
if options:
237-
data.update(options)
238-
239-
return self.post(self.base_url, body=self.encode(data))
240-
241-
def details(self):
242-
"""
243-
Gets your account details.
244-
"""
245-
data = {'api_key': self.api_key}
246-
247-
return self.get(self.base_url, params=urlencode(data))
248-
249-
def integration(self):
250-
"""
251-
Puts your account into integration mode.
252-
"""
253-
data = {'api_key': self.api_key}
254-
255-
return self.get(self.base_url + '/integration',
256-
params=urlencode(data))
257-
258-
def live(self):
259-
"""
260-
Puts your account into live mode."
261-
"""
262-
data = {'api_key': self.api_key}
263-
264-
return self.get(self.base_url + '/live',
265-
params=urlencode(data))
266-

0 commit comments

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