|
4 | 4 | import PureCloudPlatformClientV2
|
5 | 5 | from PureCloudPlatformClientV2.rest import ApiException
|
6 | 6 |
|
7 |
| -print('-------------------------------------------------------------') |
8 |
| -print('- Execute Bulk Action on recordings-') |
9 |
| -print('-------------------------------------------------------------') |
| 7 | +print("-------------------------------------------------------------") |
| 8 | +print("- Execute Bulk Action on recordings-") |
| 9 | +print("-------------------------------------------------------------") |
10 | 10 |
|
11 | 11 | # Credentials for the aws bucket
|
12 |
| -CLIENT_ID = '' |
13 |
| -CLIENT_SECRET = '' |
14 |
| -ORG_REGION = '' |
| 12 | +CLIENT_ID = "" |
| 13 | +CLIENT_SECRET = "" |
| 14 | +ORG_REGION = "" |
15 | 15 |
|
16 | 16 | # Set environment
|
17 | 17 | region = PureCloudPlatformClientV2.PureCloudRegionHosts[ORG_REGION]
|
18 | 18 | PureCloudPlatformClientV2.configuration.host = region.get_api_host()
|
19 | 19 |
|
20 | 20 | # OAuth when using Client Credentials
|
21 |
| -api_client = PureCloudPlatformClientV2.api_client.ApiClient() \ |
22 |
| - .get_client_credentials_token(CLIENT_ID, CLIENT_SECRET) |
| 21 | +api_client = ( |
| 22 | + PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token( |
| 23 | + CLIENT_ID, CLIENT_SECRET |
| 24 | + ) |
| 25 | +) |
23 | 26 |
|
24 | 27 |
|
25 | 28 | # Get the api
|
|
36 | 39 | query.conversation_query = {
|
37 | 40 | "interval": "2023-12-01T00:00:00.000Z/2024-01-07T00:00:00.000Z",
|
38 | 41 | "order": "asc",
|
39 |
| - "orderBy": "conversationStart" |
| 42 | + "orderBy": "conversationStart", |
40 | 43 | }
|
41 | 44 | print(query)
|
42 | 45 | try:
|
|
55 | 58 | try:
|
56 | 59 | get_recording_job_response = recording_api.get_recording_job(job_id)
|
57 | 60 | job_state = get_recording_job_response.state
|
58 |
| - if job_state != 'PENDING': |
| 61 | + if job_state != "PENDING": |
59 | 62 | break
|
60 | 63 | else:
|
61 | 64 | print("Job state PENDING...")
|
|
65 | 68 | sys.exit()
|
66 | 69 |
|
67 | 70 |
|
68 |
| -if job_state == 'READY': |
| 71 | +if job_state == "READY": |
69 | 72 | try:
|
70 |
| - execute_job_response = recording_api.put_recording_job(job_id, {"state": "PROCESSING"}) |
| 73 | + execute_job_response = recording_api.put_recording_job( |
| 74 | + job_id, {"state": "PROCESSING"} |
| 75 | + ) |
71 | 76 | job_state = execute_job_response.state
|
72 | 77 | print(f"Successfully execute recording bulk job { execute_job_response}")
|
73 | 78 | except ApiException as e:
|
|
79 | 84 |
|
80 | 85 | # Call delete_recording_job api
|
81 | 86 | # Can be canceled also in READY and PENDING states
|
82 |
| -if job_state == 'PROCESSING': |
| 87 | +if job_state == "PROCESSING": |
83 | 88 | try:
|
84 | 89 | cancel_job_response = recording_api.delete_recording_job(job_id)
|
85 | 90 | print(f"Successfully cancelled recording bulk job { cancel_job_response}")
|
|
101 | 106 | except ApiException as e:
|
102 | 107 | print(f"Exception when calling RecordingApi->get_recording_jobs: { e }")
|
103 | 108 | sys.exit()
|
104 |
| - |
|
0 commit comments