How to use the micawber.Provider function in micawber

To help you get started, we’ve selected a few micawber 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 django-fluent / django-fluent-contents / fluent_contents / plugins / oembeditem / backend.py View on Github external
"""
    registry = None
    if appsettings.FLUENT_OEMBED_SOURCE == "basic":
        registry = bootstrap_basic()
    elif appsettings.FLUENT_OEMBED_SOURCE == "embedly":
        params = {}
        if appsettings.MICAWBER_EMBEDLY_KEY:
            params["key"] = appsettings.MICAWBER_EMBEDLY_KEY
        registry = bootstrap_embedly(**params)
    elif appsettings.FLUENT_OEMBED_SOURCE == "noembed":
        registry = bootstrap_noembed(nowrap=1)
    elif appsettings.FLUENT_OEMBED_SOURCE == "list":
        # Fill list manually in the settings, e.g. to have a fixed set of supported secure providers.
        registry = ProviderRegistry()
        for regex, provider in appsettings.FLUENT_OEMBED_PROVIDER_LIST:
            registry.register(regex, Provider(provider))
    else:
        raise ImproperlyConfigured(
            "Invalid value of FLUENT_OEMBED_SOURCE, only 'basic', 'list', 'noembed' or 'embedly' is supported."
        )

    # Add any extra providers defined in the settings
    for regex, provider in appsettings.FLUENT_OEMBED_EXTRA_PROVIDERS:
        registry.register(regex, Provider(provider))

    return registry
github django-fluent / django-fluent-contents / fluent_contents / plugins / oembeditem / backend.py View on Github external
registry = bootstrap_embedly(**params)
    elif appsettings.FLUENT_OEMBED_SOURCE == "noembed":
        registry = bootstrap_noembed(nowrap=1)
    elif appsettings.FLUENT_OEMBED_SOURCE == "list":
        # Fill list manually in the settings, e.g. to have a fixed set of supported secure providers.
        registry = ProviderRegistry()
        for regex, provider in appsettings.FLUENT_OEMBED_PROVIDER_LIST:
            registry.register(regex, Provider(provider))
    else:
        raise ImproperlyConfigured(
            "Invalid value of FLUENT_OEMBED_SOURCE, only 'basic', 'list', 'noembed' or 'embedly' is supported."
        )

    # Add any extra providers defined in the settings
    for regex, provider in appsettings.FLUENT_OEMBED_EXTRA_PROVIDERS:
        registry.register(regex, Provider(provider))

    return registry
github divio / djangocms-oembed / djangocms_oembed / oembed_providers.py View on Github external
def bootstrap(cache=None):
    # micawbers own bootstrap basic plus some more
    pr = bootstrap_basic(cache=cache)
    # add https support for vimeo and youtube
    pr.register('https://vimeo.com/\S*', Provider('https://vimeo.com/api/oembed.json'))
    try:
        pr.unregister('https?://(\S*.)?youtu(\.be/|be\.com/watch)\S+')
    except KeyError:  # if not registered
        pass
    pr.register('https?://(\S*.)?youtu(\.be/|be\.com/watch)\S+', Provider('https://www.youtube.com/oembed?scheme=https'))
    return pr
github divio / djangocms-oembed / djangocms_oembed / oembed_providers.py View on Github external
def bootstrap(cache=None):
    # micawbers own bootstrap basic plus some more
    pr = bootstrap_basic(cache=cache)
    # add https support for vimeo and youtube
    pr.register('https://vimeo.com/\S*', Provider('https://vimeo.com/api/oembed.json'))
    try:
        pr.unregister('https?://(\S*.)?youtu(\.be/|be\.com/watch)\S+')
    except KeyError:  # if not registered
        pass
    pr.register('https?://(\S*.)?youtu(\.be/|be\.com/watch)\S+', Provider('https://www.youtube.com/oembed?scheme=https'))
    return pr