Skip to content

Commit

Permalink
Parse response code for start urls; handle shell script failure modes (
Browse files Browse the repository at this point in the history
  • Loading branch information
SamanthaFullerton authored and leslitagordita committed Jul 20, 2018
1 parent a1d803c commit 5d918f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
6 changes: 5 additions & 1 deletion ci/docs404.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ def __init__(self, *args, **kwargs):
callback='parse_item', follow=True),
)

def parse_start_url(self, response):
return self.parse_item(response)

def parse_item(self, response):
item = Docs404Item()

if response.status == 404:
item['referer'] = response.request.headers.get('Referer')
ref = response.request.headers.get('Referer')
item['referer'] = ref if ref else 'orphaned link'
item['status'] = response.status
item['url'] = response.url
return item
Expand Down
3 changes: 2 additions & 1 deletion ci/scripts/docs404.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euxo pipefail

pip install -r ci/requirements.txt
python ci/docs404.py && python ci/test_urls.py
python ci/docs404.py
20 changes: 0 additions & 20 deletions ci/test_urls.py

This file was deleted.

0 comments on commit 5d918f1

Please sign in to comment.