vishap package

Submodules

vishap.base module

class vishap.base.BaseVideoPlugin[source]

Bases: object

Base video plugin.

description = None
embed_code = None
height_param_code = 'height="{height}"'
id_pattern = None
match(url)[source]

Check if URL matches the pattern.

Parameters:url (str) –
Return bool:
name = None
render(url, width=None, height=None)[source]

Renders the HTML code of embed video based on from URL given.

Parameters:
  • url (str) –
  • width (int) –
  • height (int) –
Return str:
thumbnail_pattern = None
uid = None
url_pattern = None
width_param_code = 'width="{width}"'

vishap.conf module

vishap.defaults module

vishap.discover module

vishap.discover.autodiscover()[source]

Autodiscovers the plugins in contrib/plugins.

vishap.exceptions module

exception vishap.exceptions.PluginCodeError[source]

Bases: exceptions.Exception

Exception raised when language code is left empty or has incorrect value.

exception vishap.exceptions.ImproperlyConfigured[source]

Bases: exceptions.Exception

Exception raised when developer didn’t configure the code properly.

exception vishap.exceptions.PluginNotFound[source]

Bases: exceptions.Exception

Exception raised when language pack is not found for the language code given.

exception vishap.exceptions.PluginDetectionError[source]

Bases: exceptions.Exception

Exception raised when language can’t be detected for the text given.

exception vishap.exceptions.InvalidRegistryItemType[source]

Bases: exceptions.ValueError

Raised when an attempt is made to register an item in the registry which does not have a proper type.

vishap.helpers module

vishap.helpers.PROJECT_DIR(base)

vishap.test module

class vishap.test.VishapTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests of vishap.utils.render_video.

setUp()[source]
test_01_get_available_plugin_uids(*args, **kwargs)[source]
test_02_render_vimeo(*args, **kwargs)[source]
test_03_render_vimeo_responsive(*args, **kwargs)[source]
test_04_render_youtube(*args, **kwargs)[source]
test_05_render_youtube_responsive(*args, **kwargs)[source]
test_06_register_custom_plugin(*args, **kwargs)[source]
test_07_register_unregister(*args, **kwargs)[source]
test_08_override_settings(*args, **kwargs)[source]

vishap.utils module

vishap.utils.render_video(url, width=None, height=None, plugin_uid=None)[source]

Renders the video.

Parameters:
  • url (str) –
  • width (int) –
  • height (int) –
  • plugin_uid (str) – Preferred plugin to render to video.
Return str:

Returns empty string on failure.

vishap.utils.ensure_autodiscover()[source]

Ensures that plugins are autodiscovered.

vishap.utils.get_registered_plugins()[source]

Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.

Return list:
vishap.utils.get_registered_plugin_uids()[source]

Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.

Return list:

Module contents

vishap.render_video(url, width=None, height=None, plugin_uid=None)

Renders the video.

Parameters:
  • url (str) –
  • width (int) –
  • height (int) –
  • plugin_uid (str) – Preferred plugin to render to video.
Return str:

Returns empty string on failure.

vishap.get_registered_plugins()

Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.

Return list:
vishap.get_registered_plugin_uids()

Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.

Return list:
vishap.ensure_autodiscover()

Ensures that plugins are autodiscovered.