Skip to content

Commit

Permalink
fix: Disable OffsiteMiddleware (AttributeError: 'OffsiteMiddleware' o…
Browse files Browse the repository at this point in the history
…bject has no attribute 'host_regex')
  • Loading branch information
jpmckinney committed May 14, 2024
1 parent b218ced commit 5c2dee4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions kingfisher_scrapy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
DOWNLOADER_MIDDLEWARES = {
'scrapy.downloadermiddlewares.offsite.OffsiteMiddleware': None,
'kingfisher_scrapy.downloadermiddlewares.DelayedRequestMiddleware': 543,
}

Expand Down
3 changes: 2 additions & 1 deletion test_delayed_request_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def download_func(spider, request):

spider = spider_with_crawler(settings={
'DOWNLOADER_MIDDLEWARES': {
'scrapy.downloadermiddlewares.offsite.OffsiteMiddleware': None,
'kingfisher_scrapy.downloadermiddlewares.DelayedRequestMiddleware': 543,
},
})
Expand All @@ -36,7 +37,7 @@ def download_func(spider, request):

spent = time.time() - start

assert results == [request]
assert results == [request], results
assert 1 <= spent <= 1.5, spent


Expand Down

0 comments on commit 5c2dee4

Please sign in to comment.