@@ -44,7 +44,7 @@ def __init__(self, access_token):
4444
4545 def submit_job_url (
4646 self ,
47- media_url ,
47+ media_url = None ,
4848 metadata = None ,
4949 callback_url = None ,
5050 skip_diarization = False ,
@@ -61,18 +61,20 @@ def submit_job_url(
6161 rush = None ,
6262 test_mode = None ,
6363 segments_to_transcribe = None ,
64- speaker_names = None ):
64+ speaker_names = None ,
65+ source_config = None ,
66+ notification_config = None ):
6567 """Submit media given a URL for transcription.
66- The audio data is downloaded from the URL.
67-
68+ The audio data is downloaded from the URL
6869 :param media_url: web location of the media file
70+ .. deprecated:: 2.16.0
71+ Use source_config instead
6972 :param metadata: info to associate with the transcription job
70- :param callback_url: callback url to invoke on job completion as
71- a webhook
72- :param skip_diarization: should Rev AI skip diaization when
73- transcribing this file
74- :param skip_punctuation: should Rev AI skip punctuation when
75- transcribing this file
73+ :param callback_url: callback url to invoke on job completion as a webhook
74+ .. deprecated:: 2.16.0
75+ Use notification_config instead
76+ :param skip_diarization: should Rev AI skip diarization when transcribing this file
77+ :param skip_punctuation: should Rev AI skip punctuation when transcribing this file
7678 :param speaker_channels_count: the number of speaker channels in the
7779 audio. If provided the given audio will have each channel
7880 transcribed separately and each channel will be treated as a single
@@ -102,19 +104,23 @@ def submit_job_url(
102104 Sections of transcript needed to be transcribed.
103105 :param speaker_names: Only available with "human" transcriber.
104106 Human readable names of speakers in the file.
107+ :param source_config: CustomerUrlData object containing url of the source media and
108+ optional authentication headers to use when accessing the source url
109+ :param notification_config: CustomerUrlData object containing the callback url to
110+ invoke on job completion as a webhook and optional authentication headers to use when
111+ calling the callback url
105112 :returns: raw response data
106113 :raises: HTTPError
107114 """
108- if not media_url :
109- raise ValueError ('media_url must be provided' )
110- payload = self ._create_job_options_payload (media_url , metadata ,
111- callback_url , skip_diarization ,
112- skip_punctuation , speaker_channels_count ,
115+ payload = self ._create_job_options_payload (media_url , metadata , callback_url ,
116+ skip_diarization , skip_punctuation ,
117+ speaker_channels_count ,
113118 custom_vocabularies , filter_profanity ,
114119 remove_disfluencies , delete_after_seconds ,
115120 language , custom_vocabulary_id , transcriber ,
116121 verbatim , rush , test_mode ,
117- segments_to_transcribe , speaker_names )
122+ segments_to_transcribe , speaker_names ,
123+ source_config , notification_config )
118124
119125 response = self ._make_http_request (
120126 "POST" ,
@@ -143,18 +149,18 @@ def submit_job_local_file(
143149 rush = None ,
144150 test_mode = None ,
145151 segments_to_transcribe = None ,
146- speaker_names = None ):
152+ speaker_names = None ,
153+ notification_config = None ):
147154 """Submit a local file for transcription.
148155 Note that the content type is inferred if not provided.
149156
150157 :param filename: path to a local file on disk
151158 :param metadata: info to associate with the transcription job
152- :param callback_url: callback url to invoke on job completion as a
153- webhook
154- :param skip_diarization: should Rev AI skip diaization when
155- transcribing this file
156- :param skip_punctuation: should Rev AI skip punctuation when
157- transcribing this file
159+ :param callback_url: callback url to invoke on job completion as a webhook
160+ .. deprecated:: 2.16.0
161+ Use notification_config instead
162+ :param skip_diarization: should Rev AI skip diarization when transcribing this file
163+ :param skip_punctuation: should Rev AI skip punctuation when transcribing this file
158164 :param speaker_channels_count: the number of speaker channels in the
159165 audio. If provided the given audio will have each channel
160166 transcribed separately and each channel will be treated as a single
@@ -184,19 +190,24 @@ def submit_job_local_file(
184190 Sections of transcript needed to be transcribed.
185191 :param speaker_names: Only available with "human" transcriber.
186192 Human readable names of speakers in the file.
193+ :param notification_config: CustomerUrlData object containing the callback url to
194+ invoke on job completion as a webhook and optional authentication headers to use when
195+ calling the callback url
187196 :returns: raw response data
188- :raises: HTTPError
197+ :raises: HTTPError, ValueError
189198 """
190199 if not filename :
191200 raise ValueError ('filename must be provided' )
192201
193- payload = self ._create_job_options_payload (None , metadata , callback_url , skip_diarization ,
194- skip_punctuation , speaker_channels_count ,
202+ payload = self ._create_job_options_payload (None , metadata , callback_url ,
203+ skip_diarization , skip_punctuation ,
204+ speaker_channels_count ,
195205 custom_vocabularies , filter_profanity ,
196206 remove_disfluencies , delete_after_seconds ,
197207 language , custom_vocabulary_id , transcriber ,
198208 verbatim , rush , test_mode ,
199- segments_to_transcribe , speaker_names )
209+ segments_to_transcribe , speaker_names , None ,
210+ notification_config )
200211
201212 with open (filename , 'rb' ) as f :
202213 files = {
@@ -426,7 +437,8 @@ def get_account(self):
426437 return Account .from_json (response .json ())
427438
428439 def _create_job_options_payload (
429- self , media_url ,
440+ self ,
441+ media_url = None ,
430442 metadata = None ,
431443 callback_url = None ,
432444 skip_diarization = None ,
@@ -443,7 +455,9 @@ def _create_job_options_payload(
443455 rush = None ,
444456 test_mode = None ,
445457 segments_to_transcribe = None ,
446- speaker_names = None ):
458+ speaker_names = None ,
459+ source_config = None ,
460+ notification_config = None ):
447461 payload = {}
448462 if media_url :
449463 payload ['media_url' ] = media_url
@@ -456,8 +470,7 @@ def _create_job_options_payload(
456470 if callback_url :
457471 payload ['callback_url' ] = callback_url
458472 if custom_vocabularies :
459- payload ['custom_vocabularies' ] = \
460- utils ._process_vocabularies (custom_vocabularies )
473+ payload ['custom_vocabularies' ] = utils ._process_vocabularies (custom_vocabularies )
461474 if speaker_channels_count :
462475 payload ['speaker_channels_count' ] = speaker_channels_count
463476 if filter_profanity :
@@ -483,6 +496,10 @@ def _create_job_options_payload(
483496 if speaker_names :
484497 payload ['speaker_names' ] = \
485498 utils ._process_speaker_names (speaker_names )
499+ if source_config :
500+ payload ['source_config' ] = source_config .to_dict ()
501+ if notification_config :
502+ payload ['notification_config' ] = notification_config .to_dict ()
486503 return payload
487504
488505 def _create_captions_query (self , speaker_channel ):
0 commit comments