Skip to content

Commit 605262a

Browse files
committed
change create_cpix_user_request from cert to cert_path
1 parent 8f9b400 commit 605262a

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

qencode/drm/buydrm_v4.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
def create_cpix_user_request(
99
key_ids, media_id,
1010
content_id, commonEncryptionScheme,
11-
private_key, public_cert, delivery_public_cert=None,
11+
private_key_path, public_cert_path, delivery_public_cert_path=None,
1212
use_playready=False, use_widevine=False, use_fairplay=False,
1313
nsmap=const.NSMAP
1414
):
15-
if delivery_public_cert is None:
15+
private_key = open(private_key_path, 'r').read()
16+
public_cert = open(public_cert_path, 'r').read()
17+
if delivery_public_cert_path is None:
1618
delivery_public_cert_path = (os.path.dirname(__file__) + '/keys/qencode-public_cert.pem')
1719
delivery_public_cert = open(delivery_public_cert_path, 'rb').read()
1820

sample-code/drm/buydrm/buydrm_v4.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
API_KEY = 'your-api-qencode-key'
1212
# specify path to your BuyDRM certificate files,
1313
# for example create dir keys/ and put keys into
14-
enduser_pvk, enduser_pub = [
15-
open('keys/' + p, 'r').read() for p in (
16-
'user-private_key.pem',
17-
'user-public_cert.pem',
18-
# 'qencode-public_cert.pem',
19-
)
20-
]
14+
enduser_pvk_path = 'keys/user-private_key.pem'
15+
enduser_pub_path = 'keys/user-public_cert.pem'
2116
# Qencode query template for job with {cpix_request}
2217
query_json = 'query.json'
2318
# correspond to stream resolution in query.json
@@ -41,7 +36,7 @@ def start_encode():
4136
cpix_request = create_cpix_user_request(
4237
key_ids, media_id,
4338
content_id, common_encryption,
44-
enduser_pvk, enduser_pub, #delivery_public_cert=None, # if None - get from SDK, else - set public Qenocde certificate
39+
enduser_pvk_path, enduser_pub_path, #delivery_public_cert_path=None, # if None - get from SDK, else - set public Qenocde certificate
4540
use_playready=drm_list['PR'], use_widevine=drm_list['WV'], use_fairplay=drm_list['FP']
4641
)
4742

0 commit comments

Comments
 (0)