How to use the jwplatform.errors.JWPlatformNotFoundError 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 / tests / test_errors.py View on Github external
'status': 'error',
            'code': 'UnknownError',
            'title': 'An Unknown Error occurred',
            'message': ''
        },
        'expected_exception': jwplatform.errors.JWPlatformUnknownError
    },
    {
        'http_status': 404,
        'response': {
            'status': 'error',
            'code': 'NotFound',
            'title': 'Not Found',
            'message': 'Item not found'
        },
        'expected_exception': jwplatform.errors.JWPlatformNotFoundError
    },
    {
        'http_status': 400,
        'response': {
            'status': 'error',
            'code': 'NoMethod',
            'title': 'No Method Specified',
            'message': ''
        },
        'expected_exception': jwplatform.errors.JWPlatformNoMethodError
    },
    {
        'http_status': 501,
        'response': {
            'status': 'error',
            'code': 'NotImplemented',
github jwplayer / jwplatform-py / tests / test_resource.py View on Github external
def test_nonexisting_resource():
    url_expr = re.compile(r'https?://api\.test\.tst/v1/videos/abcd/show\?.*'
                          'abcd_key=AbcdKey.*')
    responses.add(
        responses.GET, url_expr,
        status=404,
        content_type='application/json',
        body='{"status": "error", '
             '"message": "API method `/videos/abcd/show` not found", '
             '"code": "NotFound", "title": "Not Found"}')

    jwp_client = jwplatform.Client('api_key', 'api_secret', host='api.test.tst')

    with pytest.raises(jwplatform.errors.JWPlatformNotFoundError) as err:
        jwp_client.videos.abcd.show(abcd_key='AbcdKey')

    assert err.value.message == 'API method `/videos/abcd/show` not found'