'Kicks off an asynchronous course import and returns an ID to be used to check
the task\'s status'

def post(self, request, course_id):

    courselike_key = CourseKey.from_string(course_id)
    if (not has_course_author_access(request.user, courselike_key)):
        return self.make_error_response(status_code=status.HTTP_403_FORBIDDEN, developer_message='The    user    requested    does    not    have    the    required    permissions.', error_code='user_mismatch')
    try:
        if ('course_data' not in request.FILES):
            return self.make_error_response(status_code=status.HTTP_400_BAD_REQUEST, developer_message='Missing    required    parameter', error_code='internal_error', field_errors={'course_data': '"course_data"    parameter    is    required,    and    must    be    a    .tar.gz    file'})
        filename = request.FILES['course_data'].name
        if (not filename.endswith('.tar.gz')):
            return self.make_error_response(status_code=status.HTTP_400_BAD_REQUEST, developer_message='Parameter    in    the    wrong    format', error_code='internal_error', field_errors={'course_data': '"course_data"    parameter    is    required,    and    must    be    a    .tar.gz    file'})
        course_dir = (path(settings.GITHUB_REPO_ROOT) / base64.urlsafe_b64encode(repr(courselike_key)))
        temp_filepath = (course_dir / filename)
        if (not course_dir.isdir()):
            os.mkdir(course_dir)
        log.debug('importing    course    to    {0}'.format(temp_filepath))
        with open(temp_filepath, 'wb+') as temp_file:
            for chunk in request.FILES['course_data'].chunks():
                temp_file.write(chunk)
        log.info('Course    import    %s:    Upload    complete', courselike_key)
        with open(temp_filepath, 'rb') as local_file:
            django_file = File(local_file)
            storage_path = course_import_export_storage.save((u'olx_import/' + filename), django_file)
        async_result = import_olx.delay(request.user.id, text_type(courselike_key), storage_path, filename, request.LANGUAGE_CODE)
        return Response({'task_id': async_result.task_id})
    except Exception as e:
        return self.make_error_response(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, developer_message=str(e), error_code='internal_error')
