def request_to_dict(request, spider=None):
    cb = request.callback
    if callable(cb):
        cb = _find_method(spider, cb)
    eb = request.errback
    if callable(eb):
        eb = _find_method(spider, eb)
    d = {
        'url': to_unicode(request.url),  # urls should be safe (safe_string_url)
        'callback': cb,
        'errback': eb,
        'method': request.method,
        'headers': dict(request.headers),
        'body': request.body,
        'cookies': request.cookies,
        'meta': request.meta,
        '_encoding': request._encoding,
        'priority': request.priority,
        'dont_filter': request.dont_filter,
    }
    return d
Return the state of the sensor.
dataset/ETHPy150Open scrapy/scrapy/scrapy/utils/reqser.py/request_to_dict--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/demo.py/DemoSensor.state