Commit b96b1e55 by muhammad-ammar

improve url construction

parent dc99e5c7
...@@ -90,7 +90,7 @@ def scrub_query_params(url, params_to_scrub): ...@@ -90,7 +90,7 @@ def scrub_query_params(url, params_to_scrub):
>>> old_url = https://sandbox.veda.com/api/do?api_token=veda_api_key&job_name=12345&language=en&v=1 >>> old_url = https://sandbox.veda.com/api/do?api_token=veda_api_key&job_name=12345&language=en&v=1
>>> new_url = https://sandbox.veda.com/api/do?v=1&job_name=12345&language=en&api_token=XXXXXXXXXXXX >>> new_url = https://sandbox.veda.com/api/do?v=1&job_name=12345&language=en&api_token=XXXXXXXXXXXX
""" """
parsed = urlparse.urlparse(urllib.unquote(url)) parsed = urlparse.urlparse(url)
# query_params will be in the form of [('v', '1'), ('job_name', '12345')] # query_params will be in the form of [('v', '1'), ('job_name', '12345')]
query_params = urlparse.parse_qsl(parsed.query) query_params = urlparse.parse_qsl(parsed.query)
......
...@@ -146,13 +146,13 @@ class Cielo24TranscriptTests(TestCase): ...@@ -146,13 +146,13 @@ class Cielo24TranscriptTests(TestCase):
v=CIELO24_API_VERSION, v=CIELO24_API_VERSION,
job_id='000-111-222', job_id='000-111-222',
target_language='TARGET_LANG', target_language='TARGET_LANG',
callback_url=build_url( callback_url='{}?job_id={}&iwp_name={}&lang_code={}&org={}&video_id={}'.format(
'https://veda.edx.org/cielo24/transcript_completed/1234567890', 'https://veda.edx.org/cielo24/transcript_completed/1234567890',
lang_code='TARGET_LANG', '000-111-222',
video_id='12345', '{iwp_name}',
job_id='000-111-222', 'TARGET_LANG',
iwp_name='{iwp_name}', 'MAx',
org='MAx', '12345',
), ),
api_token='cielo24_api_key', api_token='cielo24_api_key',
priority='PRIORITY', priority='PRIORITY',
......
...@@ -117,13 +117,13 @@ class Cielo24Transcript(object): ...@@ -117,13 +117,13 @@ class Cielo24Transcript(object):
""" """
Request cielo24 to generate transcripts for a video. Request cielo24 to generate transcripts for a video.
""" """
callback_url = build_url( callback_url = '{}?job_id={}&iwp_name={}&lang_code={}&org={}&video_id={}'.format(
self.callback_base_url, self.callback_base_url,
job_id=job_id, job_id,
iwp_name='{iwp_name}', '{iwp_name}',
lang_code=lang_code, lang_code,
org=self.org, self.org,
video_id=self.video.studio_id self.video.studio_id
) )
perform_transcript_url = build_url( perform_transcript_url = build_url(
...@@ -136,7 +136,7 @@ class Cielo24Transcript(object): ...@@ -136,7 +136,7 @@ class Cielo24Transcript(object):
api_token=self.api_key, api_token=self.api_key,
priority=self.turnaround, priority=self.turnaround,
transcription_fidelity=self.fidelity, transcription_fidelity=self.fidelity,
options=json.dumps({"return_iwp": ["FINAL"]}) options=json.dumps({"return_iwp":["FINAL"]})
) )
response = requests.get(perform_transcript_url) response = requests.get(perform_transcript_url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment