Skip to content

Commit

Permalink
nepal_dhangadhi: add retry for 403 erros
Browse files Browse the repository at this point in the history
Signed-off-by: Yohanna Lisnichuk <yohanitalisnichuk@gmail.com>
  • Loading branch information
yolile committed Mar 2, 2021
1 parent 4c72dda commit d3dca0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kingfisher_scrapy/spiders/nepal_dhangadhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ def parse_list(self, response):
# A URL might redirect to https://admin.ims.susasan.org/login
yield self.build_request(pattern.format(item['name']), formatter=components(-1),
meta={'dont_redirect': True})

def parse(self, response):
# if we got a redirect response we try it again to download that file
if response.status == 302:
yield self.build_request(response.request.url, formatter=components(-1),
dont_filter=True)
else:
yield from super().parse(response)

0 comments on commit d3dca0a

Please sign in to comment.