# -*- coding: utf-8 -*-

"""
This modules manages SSR rendering logic
"""
import logging

from django.conf import settings
import requests

from django_react_templatetags.templatetags.react_jsonfilter import (
    ReactRepresentationJSONEncoder
)


logger = logging.getLogger(__name__)


def load_or_empty(component, props):
    inner_html = ''

    try:
        inner_html = load(component, props)
    except requests.exceptions.RequestException as e:
        logger.error(e)

    return inner_html


def load(component, props):
    req_data = {
        'componentName': component,
        'props': props
    }

    req = requests.post(settings.REACT_RENDER_HOST, data=json.dumps(
        req_data, cls=ReactRepresentationJSONEncoder
    ))

    req.raise_for_status()
    return req.text

# -*- coding: utf-8 -*-

"""
This modules manages SSR rendering logic
"""
import logging
import json

from django.conf import settings
import requests

from django_react_templatetags.templatetags.react_jsonfilter import (
    ReactRepresentationJSONEncoder
)


logger = logging.getLogger(__name__)


def load_or_empty(component, props):
    inner_html = ''

    try:
        inner_html = load(component, props)
    except requests.exceptions.RequestException as e:
        logger.error(e)

    return inner_html


def load(component, props):
    req_data = {
        'componentName': component,
        'props': props
    }

    req = requests.post(settings.REACT_RENDER_HOST, data=json.dumps(
        req_data, cls=ReactRepresentationJSONEncoder
    ))

    req.raise_for_status()
    return req.text

Add missing import