예제 #1
0
HTTP_HEADERS = {
    "User-Agent": ("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
                   "(KHTML, like Gecko) Chrome/36.0.1944.9 Safari/537.36")
}

_url_re = re.compile("http(s)?://(\w+\.)?azubu.tv/(?P<domain>\w+)")
CHANNEL_INFO_URL = "http://api.azubu.tv/public/channel/%s/player"

_viewerexp_schema = validate.Schema(
    validate.attr({
        "programmedContent": {
            "videoPlayer": validate.attr({
                "mediaDTO": validate.attr({
                    "renditions": {
                        int: validate.attr({
                            "encodingRate": int,
                            "defaultURL": validate.text
                        })
                    }
                })
            })
        }
    })
)


@AMF3ObjectBase.register("com.brightcove.experience.ViewerExperienceRequest")
class ViewerExperienceRequest(AMF3ObjectBase):
    __members__ = ["contentOverrides",
                   "experienceId",
                   "URL",
                   "playerKey",
    def test_attr(self):
        el = Element("foo")
        el.text = "bar"

        assert validate(attr({"text": text}), el).text == "bar"
예제 #3
0
    "User-Agent": ("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
                   "(KHTML, like Gecko) Chrome/36.0.1944.9 Safari/537.36")
}

_url_re = re.compile("http(s)?://(\w+\.)?azubu.tv/[^/]+")

_viewerexp_schema = validate.Schema(
    validate.attr({
        "programmedContent": {
            "videoPlayer":
            validate.attr({
                "mediaDTO":
                validate.attr({
                    "renditions": {
                        int:
                        validate.attr({
                            "encodingRate": int,
                            "defaultURL": validate.text
                        })
                    }
                })
            })
        }
    }))


@AMF3ObjectBase.register("com.brightcove.experience.ViewerExperienceRequest")
class ViewerExperienceRequest(AMF3ObjectBase):
    __members__ = [
        "contentOverrides", "experienceId", "URL", "playerKey", "deliveryType",
        "TTLToken"
    def test_attr(self):
        el = Element("foo")
        el.text = "bar"

        assert validate(attr({"text": text}), el).text == "bar"