Skip to content

Commit caf7846

Browse files
committed
Set the dryscrape headers to match the scrapy ones.
1 parent 972b31c commit caf7846

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

zipru_scraper/middlewares.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def __init__(self, settings):
1616
dryscrape.start_xvfb()
1717

1818
self.dryscrape_session = dryscrape.Session(base_url='http://zipru.to')
19+
for key, value in settings['DEFAULT_REQUEST_HEADERS'].items():
20+
# seems to be a bug with how webkit-server handles accept-encoding
21+
if key.lower() != 'accept-encoding':
22+
self.dryscrape_session.set_header(key, value)
1923

2024
def _redirect(self, redirected, request, spider, reason):
2125
# act normally if this isn't a threat defense redirect

0 commit comments

Comments
 (0)