Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup ignore warnings #89

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 0 additions & 2 deletions sh_scrapy/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import scrapy
from scrapy import signals
from scrapy import version_info as SCRAPY_VERSION_INFO
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.exporters import PythonItemExporter
from scrapy.http import Request
from scrapy.utils.deprecate import create_deprecated_class

from sh_scrapy import hsref
from sh_scrapy.crawl import ignore_warnings
from sh_scrapy.exceptions import SHScrapyDeprecationWarning
from sh_scrapy.middlewares import HS_PARENT_ID_KEY, request_id_sequence
from sh_scrapy.writer import pipe_writer
Expand Down