Mercurial > public > sg101
diff oembed/views.py @ 909:90632d090bbc
Merge with upstream.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 16 Mar 2015 21:03:37 -0500 |
parents | 344f7914d421 |
children | 4da4e32b314c |
line wrap: on
line diff
--- a/oembed/views.py Sat Mar 07 14:56:41 2015 -0600 +++ b/oembed/views.py Mon Mar 16 21:03:37 2015 -0500 @@ -43,23 +43,24 @@ if re.match(provider.url_regex, url): try: data = get_oembed(provider.api_endpoint, - url, - maxwidth=settings.OEMBED_MAXWIDTH, - maxheight=settings.OEMBED_MAXHEIGHT) + url, + maxwidth=settings.OEMBED_MAXWIDTH, + maxheight=settings.OEMBED_MAXHEIGHT, + scheme='https') except IOError, e: return HttpResponseBadRequest( "Sorry, we could not retrieve your video (%s)" % e) - if 'type' not in data or data['type'] != 'video': + if data.get('type') != 'video': return HttpResponseBadRequest( "Hey, this doesn't look like a video..??") oembed = Oembed(url=url, - type=Oembed.VIDEO, - title=data.get('title', ''), - width=int(data.get('width', 0)), - height=int(data.get('height', 0)), - html=data.get('html', '')) + type=Oembed.VIDEO, + title=data.get('title', ''), + width=int(data.get('width', 0)), + height=int(data.get('height', 0)), + html=data.get('html', '')) oembed.save() data = dict(id=oembed.id, embed=oembed.html)