本文整理汇总了Python中opentok.OpenTok.get_archive方法的典型用法代码示例。如果您正苦于以下问题:Python OpenTok.get_archive方法的具体用法?Python OpenTok.get_archive怎么用?Python OpenTok.get_archive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opentok.OpenTok
的用法示例。
在下文中一共展示了OpenTok.get_archive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpenTokArchiveApiTest
# 需要导入模块: from opentok import OpenTok [as 别名]
# 或者: from opentok.OpenTok import get_archive [as 别名]
#.........这里部分代码省略.........
httpretty.register_uri(httpretty.DELETE, u('https://api.opentok.com/v2/partner/{0}/archive/{1}').format(self.api_key, archive_id),
body=u(''),
status=204)
self.opentok.delete_archive(archive_id)
expect(httpretty.last_request().headers[u('x-tb-partner-auth')]).to.equal(self.api_key+u(':')+self.api_secret)
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
@httpretty.activate
def test_find_archive(self):
archive_id = u('f6e7ee58-d6cf-4a59-896b-6d56b158ec71')
httpretty.register_uri(httpretty.GET, u('https://api.opentok.com/v2/partner/{0}/archive/{1}').format(self.api_key, archive_id),
body=textwrap.dedent(u("""\
{
"createdAt" : 1395187836000,
"duration" : 62,
"id" : "f6e7ee58-d6cf-4a59-896b-6d56b158ec71",
"name" : "",
"partnerId" : 123456,
"reason" : "",
"sessionId" : "SESSIONID",
"size" : 8347554,
"status" : "available",
"hasAudio": true,
"hasVideo": true,
"outputMode": "composed",
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2Ff6e7ee58-d6cf-4a59-896b-6d56b158ec71%2Farchive.mp4?Expires=1395194362&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}""")),
status=200,
content_type=u('application/json'))
archive = self.opentok.get_archive(archive_id)
expect(httpretty.last_request().headers[u('x-tb-partner-auth')]).to.equal(self.api_key+u(':')+self.api_secret)
expect(httpretty.last_request().headers[u('user-agent')]).to.contain(u('OpenTok-Python-SDK/')+__version__)
expect(httpretty.last_request().headers[u('content-type')]).to.equal(u('application/json'))
expect(archive).to.be.an(Archive)
expect(archive).to.have.property(u('id')).being.equal(archive_id)
expect(archive).to.have.property(u('name')).being.equal(u(''))
expect(archive).to.have.property(u('status')).being.equal(u('available'))
expect(archive).to.have.property(u('session_id')).being.equal(u('SESSIONID'))
expect(archive).to.have.property(u('partner_id')).being.equal(123456)
if PY2:
created_at = datetime.datetime.fromtimestamp(1395187836, pytz.UTC)
if PY3:
created_at = datetime.datetime.fromtimestamp(1395187836, datetime.timezone.utc)
expect(archive).to.have.property(u('created_at')).being.equal(created_at)
expect(archive).to.have.property(u('size')).being.equal(8347554)
expect(archive).to.have.property(u('duration')).being.equal(62)
expect(archive).to.have.property(u('url')).being.equal(u('http://tokbox.com.archive2.s3.amazonaws.com/123456%2Ff6e7ee58-d6cf-4a59-896b-6d56b158ec71%2Farchive.mp4?Expires=1395194362&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'))
@httpretty.activate
def test_find_archives(self):
httpretty.register_uri(httpretty.GET, u('https://api.opentok.com/v2/partner/{0}/archive').format(self.api_key),
body=textwrap.dedent(u("""\
{
"count" : 6,
"items" : [ {
"createdAt" : 1395187930000,
"duration" : 22,
"id" : "ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d",
"name" : "",
"partnerId" : 123456,
"reason" : "",