scrapy/scrapy
Adnan Awan d2290c35c2
Allow configuring the log level of the retry give-up message (#7567)
* Allow configuring the log level of the retry give-up message

The "Gave up retrying ..." message was always logged at ERROR, which
inflates the log_count/ERROR stat even when giving up on a request is
expected (e.g. broad crawls hitting dead hosts).

Add a RETRY_GIVE_UP_LOG_LEVEL setting, a give_up_log_level argument to
get_retry_request(), and a give_up_log_level request meta key to override
it per request. The value accepts a level name ("WARNING") or number
(logging.WARNING). The default ("ERROR") preserves the previous behaviour.

Fixes #5297, fixes #4622

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Address Adrian's review feedback: simplify and reorganize docs

- Move give_up_log_level reqmeta section before max_retry_times (alphabetical order)
- Simplify give_up_log_level section in request-response.rst (brief, links to setting)
- Simplify RETRY_GIVE_UP_LOG_LEVEL setting docs in downloader-middleware.rst
- Change 'When initialized' to 'When set' in max_retry_times section
- Docs now follow pattern of linking to complementary setting/meta key rather than duplicating information

Per Adrian's feedback: keep docs concise and cross-link setting ↔ meta key

* Address Adrian's code review feedback on RETRY_GIVE_UP_LOG_LEVEL feature

- Fix alphabetical ordering of give_up_log_level in request-response.rst
- Remove circular references: change 'see X for details' to 'see also X' pattern
- Simplify docstring for give_up_log_level parameter (4 lines → 2 lines)
- Update test domains from www.scrapytest.org to example.com

* Apply suggestion from @AdrianAtZyte

* Minor changes

* Fix example formatting.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Adrian <adrian@zyte.com>
Co-authored-by: Andrey Rakhmatullin <wrar@wrar.name>
2026-06-08 18:44:30 +05:00
..
commands Disable mypy allow_any_generics. (#7532) 2026-05-18 15:54:06 +02:00
contracts Disable mypy allow_any_generics. (#7532) 2026-05-18 15:54:06 +02:00
core Add settings for TLS min/max version as a replacement for the TLS method (#6546) 2026-06-08 11:54:10 +02:00
downloadermiddlewares Allow configuring the log level of the retry give-up message (#7567) 2026-06-08 18:44:30 +05:00
extensions Close GCS feed temp files after upload (#7546) 2026-06-04 20:11:50 +05:00
http Support sending requests with "unsafe" URLs (#7473) 2026-06-05 11:51:03 +02:00
linkextractors chore: more ruff rules and overall minor improvements (#7386) 2026-04-03 19:00:13 +05:00
loader Improve internal refs to scrapy.Request and scrapy.Selector (#6526) 2025-01-07 16:18:18 +05:00
pipelines Enable mypy warn_return_any. (#7492) 2026-05-04 22:24:47 +02:00
selector Enable the flake8-builtins rules. (#6942) 2025-07-05 21:43:18 +05:00
settings Allow configuring the log level of the retry give-up message (#7567) 2026-06-08 18:44:30 +05:00
spidermiddlewares Drop start_requests() support. (#7490) 2026-05-04 17:34:24 +05:00
spiders Disable mypy allow_any_generics. (#7532) 2026-05-18 15:54:06 +02:00
templates docs: switch `scrapy.Item` examples to dataclasses (#7513) 2026-06-08 12:40:28 +05:00
utils Add settings for TLS min/max version as a replacement for the TLS method (#6546) 2026-06-08 11:54:10 +02:00
VERSION Bump version: 2.15.2 → 2.16.0 2026-05-19 17:27:16 +05:00
__init__.py Remove code deprecated in 2.12.0 (#7126) 2025-10-27 17:14:38 +05:00
__main__.py adding black formatter to all the code 2022-11-29 11:30:46 -03:00
addons.py Move to mypy --strict with exceptions. (#7300) 2026-03-02 15:47:23 +05:00
cmdline.py Reactorless shell and other small shell improvements (#7395) 2026-04-08 18:24:51 +05:00
crawler.py chore: simplify some code, get rid of nested fns where it's makes sence + pylint (#7401) 2026-05-04 23:32:46 +05:00
dupefilters.py Add Jobdir documentation (#5260) 2026-02-06 22:33:02 +04:00
exceptions.py Refactor HTTP download handlers (#7238) 2026-02-03 20:13:30 +01:00
exporters.py Mark abstract base classes as such. (#6930) 2025-06-30 15:14:34 +05:00
extension.py Restore 2.14 getwithbase, add a new method for class key deduplication (#7449) 2026-04-22 19:01:59 +05:00
interfaces.py Remove useless pylint: disable lines. 2025-01-02 12:32:25 +05:00
item.py Update the outdated Item docstring. (#6427) 2024-11-04 16:17:56 +05:00
link.py Enable RUF Ruff rules. 2025-01-01 21:41:08 +05:00
logformatter.py Release notes for 2.14.0 (#7035) 2026-01-05 14:51:05 +05:00
mail.py chore: more ruff rules and overall minor improvements (#7386) 2026-04-03 19:00:13 +05:00
middleware.py Disable mypy allow_any_generics. (#7532) 2026-05-18 15:54:06 +02:00
mime.types moved module scrapy.core.downloader.responsetypes to scrapy.responsetypes 2011-08-07 02:49:57 -03:00
pqueues.py Fix DownloaderAwarePriorityQueue tie-breaking across slots (#7351) 2026-04-08 16:10:21 +02:00
py.typed Add py.typed 2023-09-21 13:06:12 +02:00
resolver.py Add flake8-raise rules to ruff. 2024-12-12 20:33:35 +05:00
responsetypes.py chore: more ruff rules and overall minor improvements (#7386) 2026-04-03 19:00:13 +05:00
robotstxt.py Enable mypy warn_return_any. (#7492) 2026-05-04 22:24:47 +02:00
shell.py Update the TLS code to Twisted 26.4.0 (#7347) 2026-05-12 18:22:31 +05:00
signalmanager.py Move to mypy --strict with exceptions. (#7300) 2026-03-02 15:47:23 +05:00
signals.py Deprecate the mail API (#7263) 2026-03-24 21:31:12 +01:00
spiderloader.py chore: more ruff rules and overall minor improvements (#7386) 2026-04-03 19:00:13 +05:00
squeues.py Disable mypy allow_any_generics. (#7532) 2026-05-18 15:54:06 +02:00
statscollectors.py Move to mypy --strict with exceptions. (#7300) 2026-03-02 15:47:23 +05:00