Logs a message when an item is dropped while it is passing through the item pipeline.
(
self,
item: Any,
exception: BaseException,
response: Response | Failure | None,
spider: Spider,
)
| 113 | } |
| 114 | |
| 115 | def dropped( |
| 116 | self, |
| 117 | item: Any, |
| 118 | exception: BaseException, |
| 119 | response: Response | Failure | None, |
| 120 | spider: Spider, |
| 121 | ) -> LogFormatterResult: |
| 122 | """Logs a message when an item is dropped while it is passing through the item pipeline.""" |
| 123 | if (level := getattr(exception, "log_level", None)) is None: |
| 124 | level = spider.crawler.settings["DEFAULT_DROPITEM_LOG_LEVEL"] |
| 125 | if isinstance(level, str): |
| 126 | level = getattr(logging, level) |
| 127 | return { |
| 128 | "level": level, |
| 129 | "msg": DROPPEDMSG, |
| 130 | "args": { |
| 131 | "exception": exception, |
| 132 | "item": item, |
| 133 | }, |
| 134 | } |
| 135 | |
| 136 | def item_error( |
| 137 | self, |
no outgoing calls
no test coverage detected