@@ -52,7 +52,10 @@ def decode(self, raw_body):
52
52
Returns the raw_body as json (the default) or XML
53
53
"""
54
54
if not self .as_xml :
55
- return json .loads (raw_body )
55
+ if not raw_body or raw_body == ' ' :
56
+ return None
57
+ else :
58
+ return json .loads (raw_body )
56
59
57
60
def post (self ,url ,body = None ):
58
61
"""
@@ -191,3 +194,38 @@ def __init__(self, api_key, as_xml=False):
191
194
"""
192
195
super (Account ,self ).__init__ (api_key ,as_xml ,'account' )
193
196
197
+ def create (self ,email ,tos = True ,options = None ):
198
+ """
199
+ Creates an account with Zencoder.
200
+ """
201
+ data = {'email' :email ,
202
+ 'terms_of_service' :int (tos )}
203
+
204
+ if options :
205
+ data .update (options )
206
+
207
+ return self .post (self .base_url ,body = self .encode (data ))
208
+
209
+ def details (self ):
210
+ """
211
+ Gets your account details
212
+ """
213
+ data = {'api_key' :self .api_key }
214
+ return self .get (self .base_url ,params = urlencode (data ))
215
+
216
+ def integration (self ):
217
+ """
218
+ Puts your account into integration mode
219
+ """
220
+ data = {'api_key' :self .api_key }
221
+ return self .get (self .base_url + '/integration' ,
222
+ params = urlencode (data ))
223
+
224
+ def live (self ):
225
+ """
226
+ Puts your account into live mode
227
+ """
228
+ data = {'api_key' :self .api_key }
229
+ return self .get (self .base_url + '/live' ,
230
+ params = urlencode (data ))
231
+