Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add transcript credentials api #210

Merged
merged 5 commits into from
Apr 1, 2020

Conversation

DawoudSheraz
Copy link
Contributor

@DawoudSheraz DawoudSheraz commented Mar 30, 2020

PROD-1380

Description

This PR is adding two API endpoints for TranscriptCredentials model(added in #208) with the following capabilities:

  • GET the credentials for a given org & provider. This endpoint will be used by VEM. The read permission is restricted.
  • Create/Update credentials for an org. This is an internal endpoint, utilized by platform.

The purpose of the API is to move the transcription information part out of VEDA and into the VAL as part of VEM development. Most bits of the code are taken from VEDA with necessary changes https://github.com/edx/edx-video-pipeline/blob/master/VEDA_OS01/views.py#L119.

Another important bit that the following settings should be added to platform so that it can be overridden and eventually used by VAL during the deployment:

CIELO24_SETTINGS = dict(
    CIELO24_API_VERSION=1,
    CIELO24_BASE_API_URL="https://sandbox.cielo24.com/api",
    CIELO24_LOGIN_URL="https://sandbox.cielo24.com/api/account/login"
)

edxval/views.py Outdated

return Response(status=status_code, data=data)

def get_cielo_token_response(self, username, api_secure_key):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it would be cleaner to separate out provider-specific stuff like this (and the settings that go with it) into separate source files. Just seems a little out of place to have Cielo-specific stuff here in the middle of views.py. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it will make the view code more compact. I will update the PR.

Copy link
Contributor Author

@DawoudSheraz DawoudSheraz Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The settings should be left in Django settings. The reason being that Cielo API URL is different in different environments. Right now, we are using a sandboxing URL. In VEDA, the URL is defined in edx-video-worker instance-config.yaml but it is sandboxing URL in edx-video-pipeline. That's why I am thinking that we can override Cielo URL settings at deployment and use actual API URL. Although I will make the code to use defaults if some settings aren't found.

# Transcript provider settings variables, which will be overridden at deployment if needed
# NOTE: These settings must be added in edx-platform settings to allow deployment override and val integration
CIELO24_SETTINGS = dict(
CIELO24_API_VERSION=1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since these settings will live both on val/platform and vem, we should add a comment suggesting to change the version, whenever we do, in both places (VEM and VAL/Platform) or keep it in some config repo to update it in one place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These settings aren't utilized by edxval as edxval is to be plugged in edx-platform. I will add the comment when adding the settings in platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the settings here to show what set of values are present in it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@DawoudSheraz
Copy link
Contributor Author

DawoudSheraz commented Mar 31, 2020

@zainab-amir / @azarembok Can you take a second look? I have done major code refactoring, mainly move the post part of API to be an internal API function(to comply with how edx-platform uses edxval). The tests have also been moved into different suites accordingly.

missing=' and '.join(missing)
)

return TranscriptionProviderErrorType.MISSING_REQUIRED_ATTRIBUTES, error_message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it always returning MISSING_REQUIRED_ATTRIBUTES error type? Can we return None if we don't set any error message? then we will not have to explicitly set error_type to None here
085200f#diff-d78075b51c3378064d929ce6515f2181R1248

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right.

Copy link
Contributor

@azarembok azarembok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Dawoud, I think it looks much cleaner now with the refactoring.

@DawoudSheraz DawoudSheraz merged commit dfe5c54 into master Apr 1, 2020
@DawoudSheraz DawoudSheraz deleted the dsheraz/PROD-1380/add-transcripts-api branch April 1, 2020 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants