Unverified Commit e0e2d4c9 by Muhammad Ammar Committed by GitHub

Merge pull request #71 from edx/ammar/improve-url-construction

improve url construction
parents 7de77557 b96b1e55
......@@ -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
>>> 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 = urlparse.parse_qsl(parsed.query)
......
......@@ -146,13 +146,13 @@ class Cielo24TranscriptTests(TestCase):
v=CIELO24_API_VERSION,
job_id='000-111-222',
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',
lang_code='TARGET_LANG',
video_id='12345',
job_id='000-111-222',
iwp_name='{iwp_name}',
org='MAx',
'000-111-222',
'{iwp_name}',
'TARGET_LANG',
'MAx',
'12345',
),
api_token='cielo24_api_key',
priority='PRIORITY',
......
......@@ -117,13 +117,13 @@ class Cielo24Transcript(object):
"""
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,
job_id=job_id,
iwp_name='{iwp_name}',
lang_code=lang_code,
org=self.org,
video_id=self.video.studio_id
job_id,
'{iwp_name}',
lang_code,
self.org,
self.video.studio_id
)
perform_transcript_url = build_url(
......@@ -136,7 +136,7 @@ class Cielo24Transcript(object):
api_token=self.api_key,
priority=self.turnaround,
transcription_fidelity=self.fidelity,
options=json.dumps({"return_iwp": ["FINAL"]})
options=json.dumps({"return_iwp":["FINAL"]})
)
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