How to use the jwplatform.errors.JWPlatformError function in jwplatform

To help you get started, we’ve selected a few jwplatform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwplayer / jwplatform-py / examples / video_multipart_create.py View on Github external
'file_path': video_file_path,
        'file_size': os.stat(video_file_path).st_size,
        'file_name': os.path.basename(video_file_path)
    }

    try:
        # Setup API client
        jwplatform_client = Client(JW_API_KEY, JW_API_SECRET)

        # Make /videos/create API call with multipart parameter specified
        jwplatform_video_create_response = jwplatform_client.videos.create(
            upload_method='multipart',
            title=upload_parameters['file_name']
        )

    except JWPlatformError:
        logging.exception('An error occurred during the uploader setup. Check that your API keys are properly '
                          'set up in your environment, and ensure that the video file path exists.')
        return

    # Construct base url for upload
    upload_parameters['upload_url'] = '{protocol}://{address}{path}'.format(**jwplatform_video_create_response['link'])

    logging.info('Upload URL to be used: {}'.format(upload_parameters['upload_url']))

    upload_parameters['query_parameters'] = jwplatform_video_create_response['link']['query']
    upload_parameters['query_parameters']['api_format'] = 'json'
    upload_parameters['headers'] = {'X-Session-ID': jwplatform_video_create_response['session_id']}
    # The chunk offset will be updated several times during the course of the upload
    upload_parameters['chunk_offset'] = 0

    # Perform the multipart upload
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Integrity Error"""


class JWPlatformDigestMissingError(JWPlatformError):
    """Digest Missing"""


class JWPlatformDigestInvalidError(JWPlatformError):
    """Digest Invalid"""


class JWPlatformFileUploadFailedError(JWPlatformError):
    """File Upload Failed"""


class JWPlatformFileSizeMissingError(JWPlatformError):
    """File Size Missing"""


class JWPlatformFileSizeInvalidError(JWPlatformError):
    """File Size Invalid"""


class JWPlatformInternalError(JWPlatformError):
    """Internal Error"""


class JWPlatformApiKeyMissingError(JWPlatformError):
    """User Key Missing"""


class JWPlatformApiKeyInvalidError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Call Failed"""


class JWPlatformCallUnavailableError(JWPlatformError):
    """Call Unavailable"""


class JWPlatformCallInvalidError(JWPlatformError):
    """Call Invalid"""


class JWPlatformParameterMissingError(JWPlatformError):
    """Missing Parameter"""


class JWPlatformParameterEmptyError(JWPlatformError):
    """Empty Parameter"""


class JWPlatformParameterEncodingError(JWPlatformError):
    """Parameter Encoding Error"""


class JWPlatformParameterInvalidError(JWPlatformError):
    """Invalid Parameter"""


class JWPlatformPreconditionFailedError(JWPlatformError):
    """Precondition Failed"""


class JWPlatformItemAlreadyExistsError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""No Method Specified"""


class JWPlatformNotImplementedError(JWPlatformError):
    """Method Not Implemented"""


class JWPlatformNotSupportedError(JWPlatformError):
    """Method or parameter not supported"""


class JWPlatformCallFailedError(JWPlatformError):
    """Call Failed"""


class JWPlatformCallUnavailableError(JWPlatformError):
    """Call Unavailable"""


class JWPlatformCallInvalidError(JWPlatformError):
    """Call Invalid"""


class JWPlatformParameterMissingError(JWPlatformError):
    """Missing Parameter"""


class JWPlatformParameterEmptyError(JWPlatformError):
    """Empty Parameter"""


class JWPlatformParameterEncodingError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Invalid Parameter"""


class JWPlatformPreconditionFailedError(JWPlatformError):
    """Precondition Failed"""


class JWPlatformItemAlreadyExistsError(JWPlatformError):
    """Item Already Exists"""


class JWPlatformPermissionDeniedError(JWPlatformError):
    """Permission Denied"""


class JWPlatformDatabaseError(JWPlatformError):
    """Database Error"""


class JWPlatformIntegrityError(JWPlatformError):
    """Integrity Error"""


class JWPlatformDigestMissingError(JWPlatformError):
    """Digest Missing"""


class JWPlatformDigestInvalidError(JWPlatformError):
    """Digest Invalid"""


class JWPlatformFileUploadFailedError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Nonce Missing"""


class JWPlatformNonceInvalidError(JWPlatformError):
    """Nonce Invalid"""


class JWPlatformSignatureMissingError(JWPlatformError):
    """Signature Missing"""


class JWPlatformSignatureInvalidError(JWPlatformError):
    """Signature Invalid"""


class JWPlatformRateLimitExceededError(JWPlatformError):
    """Rate Limit Exceeded"""
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Not Found"""


class JWPlatformNoMethodError(JWPlatformError):
    """No Method Specified"""


class JWPlatformNotImplementedError(JWPlatformError):
    """Method Not Implemented"""


class JWPlatformNotSupportedError(JWPlatformError):
    """Method or parameter not supported"""


class JWPlatformCallFailedError(JWPlatformError):
    """Call Failed"""


class JWPlatformCallUnavailableError(JWPlatformError):
    """Call Unavailable"""


class JWPlatformCallInvalidError(JWPlatformError):
    """Call Invalid"""


class JWPlatformParameterMissingError(JWPlatformError):
    """Missing Parameter"""


class JWPlatformParameterEmptyError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""Precondition Failed"""


class JWPlatformItemAlreadyExistsError(JWPlatformError):
    """Item Already Exists"""


class JWPlatformPermissionDeniedError(JWPlatformError):
    """Permission Denied"""


class JWPlatformDatabaseError(JWPlatformError):
    """Database Error"""


class JWPlatformIntegrityError(JWPlatformError):
    """Integrity Error"""


class JWPlatformDigestMissingError(JWPlatformError):
    """Digest Missing"""


class JWPlatformDigestInvalidError(JWPlatformError):
    """Digest Invalid"""


class JWPlatformFileUploadFailedError(JWPlatformError):
    """File Upload Failed"""


class JWPlatformFileSizeMissingError(JWPlatformError):
github jwplayer / jwplatform-py / jwplatform / errors.py View on Github external
"""An Unknown Error occurred"""


class JWPlatformNotFoundError(JWPlatformError):
    """Not Found"""


class JWPlatformNoMethodError(JWPlatformError):
    """No Method Specified"""


class JWPlatformNotImplementedError(JWPlatformError):
    """Method Not Implemented"""


class JWPlatformNotSupportedError(JWPlatformError):
    """Method or parameter not supported"""


class JWPlatformCallFailedError(JWPlatformError):
    """Call Failed"""


class JWPlatformCallUnavailableError(JWPlatformError):
    """Call Unavailable"""


class JWPlatformCallInvalidError(JWPlatformError):
    """Call Invalid"""


class JWPlatformParameterMissingError(JWPlatformError):