Esempio n. 1
0
def kaltura_session():
    """ get kaltura_session from user """
    kaltura_session = input("Enter ks: ")
    config = KalturaConfiguration()
    config.serviceUrl = "https://api.kaltura.nordu.net/"
    client = KalturaClient(config)
    client.clientConfiguration["clientTag"] = "change_domain-helper"
    client.setKs(kaltura_session)
    return client
Esempio n. 2
0
def kaltura_session():
    """ get ks from user """
    ks = input("Enter ks: ")
    config = KalturaConfiguration()
    config.serviceUrl = "https://api.kaltura.nordu.net/"
    client = KalturaClient(config)
    client.clientConfiguration["clientTag"] = "appToken-helper"
    client.setKs(ks)
    return client
Esempio n. 3
0
    def app_token_session(self):
        """ create kaltura session using appToken """
        self.statusbar.showMessage("Create kaltura session using appToken")
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        filename, _ = QFileDialog.getOpenFileName(
            self,
            "QFileDialog.getOpenFileName()",
            "",
            "Json Files (*.json)",
            options=options,
        )

        try:
            with open(filename) as json_data_file:
                data = json.load(json_data_file)
                api_token_id = data["api_token_id"]
                api_token = data["api_token"]
                kaltura_partnerid = data["kaltura_partnerid"]
                kaltura_serviceurl = data["kaltura_serviceurl"]

            config = KalturaConfiguration(kaltura_partnerid)
            config.serviceUrl = kaltura_serviceurl
            self.kaltura_session = KalturaClient(config)
            user_id = ""
            widget_id = "_" + str(kaltura_partnerid)

            expiry = 86400
            result = self.kaltura_session.session.startWidgetSession(
                widget_id, expiry)
            self.kaltura_session.setKs(result.ks)
            tokenHash = hashlib.sha256(
                result.ks.encode("ascii") +
                api_token.encode("ascii")).hexdigest()
            type = KalturaSessionType.ADMIN

            result = self.kaltura_session.appToken.startSession(
                api_token_id, tokenHash, user_id, type, expiry)
            self.kaltura_session.setKs(result.ks)
            MultiDl.session_type = "appToken"
        except:
            self.error_dialog.showMessage("Error creating Kaltura session")
Esempio n. 4
0
    def admin_secret_session(self):
        """ create kaltura session using adminsecret """
        self.statusbar.showMessage("Create kaltura session using adminsecret")
        kaltura_partnerid, ok = QInputDialog.getText(
            self, "Input kaltura partnerid", "Input partnerid:")
        kaltura_adminsecret, ok = QInputDialog.getText(self,
                                                       "Input adminsecret",
                                                       "Input adminsecret:")

        try:
            config = KalturaConfiguration()
            config.serviceUrl = "https://api.kaltura.nordu.net/"
            self.kaltura_session = KalturaClient(config)
            ks = self.kaltura_session.session.start(kaltura_adminsecret, None,
                                                    KalturaSessionType.ADMIN,
                                                    kaltura_partnerid)
            self.kaltura_session.setKs(ks)
            MultiDl.session_type = "adminSecret"
        except:
            self.error_dialog.showMessage("Error creating Kaltura session")
Esempio n. 5
0
def GetConfig():
    config = KalturaConfiguration()
    config.requestTimeout = 500
    config.serviceUrl = SERVICE_URL
    config.setLogger(KalturaLogger())
    return config
def GetConfig():
    config = KalturaConfiguration(PARTNER_ID)
    config.serviceUrl = SERVICE_URL
    config.setLogger(KalturaLogger())
    return config
Esempio n. 7
0
def GetConfig():
    config = KalturaConfiguration(PARTNER_ID)
    config.serviceUrl = SERVICE_URL
    config.setLogger(KalturaLogger())
    return config
Esempio n. 8
0
def GetConfig():
    config = KalturaConfiguration()
    config.requestTimeout = 500
    config.serviceUrl = SERVICE_URL
    config.setLogger(KalturaLogger())
    return config
Esempio n. 9
0
parser = argparse.ArgumentParser(description="Helper for kaltura sessions")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-s", "--start", help="start session", action="store_true")
group.add_argument("-e", "--end", help="end session", action="store_true")
group.add_argument("-g", "--get", help="get session", action="store_true")
parser.add_argument("-c",
                    "--client-tag",
                    help="client tag",
                    metavar="client-tag")
args = parser.parse_args()
if args.start:
    partnerId = input("Enter partnerId: ")
    adminSecret = input("Enter adminSecret: ")
    conf = KalturaConfiguration()
    conf.serviceUrl = "https://api.kaltura.nordu.net"
    kc = KalturaClient(conf)
    kc.clientConfiguration["clientTag"] = args.client_tag
    ks = kc.session.start(adminSecret, None, 2, partnerId)
    print("New kalturaSession: " + ks)
elif args.get:
    kalturaSession = input("Enter kalturaSession: ")
    conf = KalturaConfiguration()
    conf.serviceUrl = "https://api.kaltura.nordu.net"
    kc = KalturaClient(conf)
    kc.setKs(kalturaSession)
    try:
        ks = kc.session.get(kalturaSession)
        print("\nkalturaSession:")
        print("sessionType: " + str(ks.sessionType.value))
        print("partnerId: " + str(ks.partnerId))