Skip to content

Commit

Permalink
Merge d3dca0a into 5ae0c29
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Mar 2, 2021
2 parents 5ae0c29 + d3dca0a commit 4781ebf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kingfisher_scrapy/spiders/nepal_dhangadhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ def parse_list(self, response):
pattern = 'https://admin.ims.susasan.org/ocds/json/dhangadhi-{}.json'
data = response.json()
for item in data['data']['fiscal_years']:
yield self.build_request(pattern.format(item['name']), formatter=components(-1))
# 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 4781ebf

Please sign in to comment.