當前位置: 首頁>>代碼示例>>Python>>正文


Python OpenTok.delete_archive方法代碼示例

本文整理匯總了Python中opentok.OpenTok.delete_archive方法的典型用法代碼示例。如果您正苦於以下問題:Python OpenTok.delete_archive方法的具體用法?Python OpenTok.delete_archive怎麽用?Python OpenTok.delete_archive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在opentok.OpenTok的用法示例。


在下文中一共展示了OpenTok.delete_archive方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OpenTokArchiveApiTest

# 需要導入模塊: from opentok import OpenTok [as 別名]
# 或者: from opentok.OpenTok import delete_archive [as 別名]

#.........這裏部分代碼省略.........
                                          "reason" : "",
                                          "sessionId" : "SESSIONID",
                                          "size" : 0,
                                          "status" : "stopped",
                                          "hasAudio": true,
                                          "hasVideo": true,
                                          "outputMode": "composed",
                                          "url" : null
                                        }""")),
                               status=200,
                               content_type=u('application/json'))

        archive = self.opentok.stop_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('stopped'))
        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(1395183243, pytz.UTC)
        if PY3:
            created_at = datetime.datetime.fromtimestamp(1395183243, datetime.timezone.utc)
        expect(archive).to.have.property(u('created_at')).being.equal(created_at)
        expect(archive).to.have.property(u('size')).being.equal(0)
        expect(archive).to.have.property(u('duration')).being.equal(0)
        expect(archive).to.have.property(u('url')).being.equal(None)

    @httpretty.activate
    def test_delete_archive(self):
        archive_id = u('30b3ebf1-ba36-4f5b-8def-6f70d9986fe9')
        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,
開發者ID:Armin-Smailzade,項目名稱:Opentok-Python-SDK,代碼行數:70,代碼來源:test_archive_api.py


注:本文中的opentok.OpenTok.delete_archive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。