MCPcopy Create free account
hub / github.com/AgoraIO/API-Examples / main

Function main

cicd/scripts/keycenter.py:6–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import os
5
6def main():
7 appId = ""
8 if "AGORA_APP_ID" in os.environ:
9 appId = os.environ["AGORA_APP_ID"]
10 token = ""
11
12 fileDirectory = ""
13 if "File_Directory" in os.environ:
14 fileDirectory = os.environ["File_Directory"]
15
16 # KeyCenter.swift
17 KeyCenterPath = fileDirectory + "/KeyCenter.swift"
18 print("KeyCenterPath: %s" %KeyCenterPath)
19
20 try:
21 f = open(KeyCenterPath, 'r+')
22 content = f.read()
23 appString = "\"" + appId + "\""
24 tokenString = "\"" + token + "\""
25 contentNew = re.sub(r'<#YOUR APPID#>', appString, content)
26 contentNew = re.sub(r'<#YOUR AppId#>', appString, contentNew)
27 contentNew = re.sub(r'<#YOUR Certificate#>', tokenString, contentNew)
28 f.seek(0)
29 f.write(contentNew)
30 f.truncate()
31 except IOError:
32 print("Swift File is not accessible.")
33
34 # KeyCenter.m
35 KeyCenterPath = fileDirectory + "/KeyCenter.m"
36
37 try:
38 f = open(KeyCenterPath, 'r+')
39 content = f.read()
40 appString = "@\"" + appId + "\""
41 tokenString = "@\"" + token + "\""
42 contentNew = re.sub(r'<#Your App Id#>', appString, content)
43 contentNew = re.sub(r'<#Temp Access Token#>', tokenString, contentNew)
44 f.seek(0)
45 f.write(contentNew)
46 f.truncate()
47 except IOError:
48 print("OC File is not accessible.")
49
50if __name__ == "__main__":
51 main()

Callers 1

keycenter.pyFile · 0.70

Calls 4

seekMethod · 0.80
printFunction · 0.50
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected