-
Notifications
You must be signed in to change notification settings - Fork 2
/
ks.py
50 lines (42 loc) · 1.29 KB
/
ks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from KalturaClient import *
from KalturaClient.Plugins.Core import *
import os
import config
def client_for_admin(username, privileges):
kaltura_config = KalturaConfiguration(config.partner_id)
kaltura_config.serviceUrl = "https://www.kaltura.com/"
client = KalturaClient(kaltura_config)
ks = client.session.start(
config.admin_secret,
username,
KalturaSessionType.ADMIN,
config.partner_id,
86400,
privileges)
client.setKs(ks)
return client
def client_for_user(username, privileges):
kaltura_config = KalturaConfiguration(config.partner_id)
kaltura_config.serviceUrl = "https://www.kaltura.com/"
client = KalturaClient(kaltura_config)
ks = client.session.start(
config.admin_secret,
username,
KalturaSessionType.USER,
config.partner_id,
86400,
privileges)
client.setKs(ks)
return client
def get_ks(username, privileges, session_type):
kaltura_config = KalturaConfiguration(config.partner_id)
kaltura_config.serviceUrl = config.service_url
client = KalturaClient(kaltura_config)
ks = client.session.start(
config.admin_secret,
username,
session_type,
config.partner_id,
86400,
privileges)
return ks