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 ae58383

Browse filesBrowse files
committed
Merge branch 'master' of https://github.com/kennedyj/zencoder-py
2 parents e794cbe + af977b6 commit ae58383
Copy full SHA for ae58383

File tree

2 files changed

+16
-4
lines changed
Filter options

2 files changed

+16
-4
lines changed

‎zencoder/__init__.py

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from core import Zencoder
2+
from core import ZencoderResponseError
23

‎zencoder/core.py

Copy file name to clipboardExpand all lines: zencoder/core.py
+15-4Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
class ZencoderError(Exception):
2626
pass
2727

28+
class ZencoderResponseError(Exception):
29+
def __init__(self, http_response, content):
30+
self.http_response = http_response
31+
self.content = content
32+
2833
class HTTPBackend(object):
2934
"""
3035
Abstracts out an HTTP backend, but defaults to httplib2
@@ -117,10 +122,16 @@ def process(self, http_response, content):
117122
"""
118123
Returns HTTP backend agnostic Response data
119124
"""
120-
code = http_response.status
121-
body = self.decode(content)
122-
response = Response(code, body, content, http_response)
123-
return response
125+
126+
try:
127+
code = http_response.status
128+
body = self.decode(content)
129+
response = Response(code, body, content, http_response)
130+
131+
return response
132+
133+
except ValueError as e:
134+
raise ZencoderResponseError(http_response, content)
124135

125136
class Zencoder(object):
126137
""" This is the entry point to the Zencoder API """

0 commit comments

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