1
- import requests
2
- import ast
3
- import urllib
4
-
5
1
"""
6
2
Cielo24 API Job Start and Download
7
3
Options (reflected in Course.models):
14
10
priority (48h)
15
11
turnaround_hours = number, overrides 'priority' call, will change a standard to a priority silently
16
12
"""
13
+ import logging
14
+ import requests
15
+ import ast
16
+ import urllib
17
+
17
18
from control_env import *
18
- from veda_utils import ErrorObject
19
19
20
20
requests .packages .urllib3 .disable_warnings ()
21
+ LOGGER = logging .getLogger (__name__ )
22
+ # TODO: Remove this temporary logging to stdout
23
+ logging .basicConfig (stream = sys .stdout , level = logging .INFO )
21
24
22
25
23
26
class Cielo24TranscriptOld (object ):
@@ -77,11 +80,9 @@ def retrieve_defaults(self):
77
80
videoID = video_query ,
78
81
encode_url__icontains = '_DTH.mp4' ,
79
82
).latest ()
80
-
83
+
81
84
if video_query .inst_class .c24_username is None :
82
- ErrorObject .print_error (
83
- message = 'Cielo24 Record Incomplete' ,
84
- )
85
+ LOGGER .error ('[VIDEO_PIPELINE] {id} : Cielo API : Course record incomplete' .format (id = self .veda_id ))
85
86
return None
86
87
87
88
c24_defaults = {
@@ -102,10 +103,8 @@ def tokengenerator(self):
102
103
# Generate Token
103
104
r1 = requests .get (token_url )
104
105
if r1 .status_code > 299 :
105
- ErrorObject .print_error (
106
- message = 'Cielo24 API Access Error' ,
107
- )
108
- return None
106
+ LOGGER .error ('[VIDEO_PIPELINE] {id} : Cielo API access' .format (id = self .veda_id ))
107
+ return
109
108
api_token = ast .literal_eval (r1 .text )["ApiToken" ]
110
109
return api_token
111
110
@@ -161,7 +160,6 @@ def embed_url(self, api_token, job_id):
161
160
urllib .quote_plus (self .c24_defaults ['url' ])
162
161
))
163
162
)
164
- print str (r4 .status_code ) + ' : Cielo24 Status Code'
165
163
return ast .literal_eval (r4 .text )['TaskId' ]
166
164
167
165
0 commit comments