Skip to content

Commit

Permalink
Do not use deprecated ignore_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elacuesta committed Nov 27, 2024
1 parent 05b30e0 commit 68a891c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sh_scrapy/crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ def _run_script(dist, script_name, namespace):
exec(code, namespace, namespace)



def _run_usercode(spider, args, apisettings_func,
log_handler=None, commands_module=None):
try:
from scrapy.exceptions import ScrapyDeprecationWarning
from sh_scrapy.settings import populate_settings

with ignore_warnings(category=ScrapyDeprecationWarning):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=ScrapyDeprecationWarning)
settings = populate_settings(apisettings_func(), spider)
if commands_module:
settings.set('COMMANDS_MODULE', commands_module, priority=40)
Expand Down

0 comments on commit 68a891c

Please sign in to comment.