It seems the wayback machine sometimes fails to return a
Content-Location header altogether. It is unclear why or how it
happens, but it did here on my personal setup:
Subject: Cron <anarcat@marcos> nice feed2exec --syslog INFO fetch
To: anarcat@anarc.at
Date: Sat, 27 Jan 2018 12:06:34 -0500
anarcat just posted: A summary of my 2017 work https://t.co/FjMMvBpLG7
Toot posted: [32mhttps://social.weho.st/@anarcat/99422857762709389[0m
plugin generated exception: 'content-location', skipping
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/feed2exec/plugins/__init__.py", line 105, in output
return plugin.output(*args, feed=feed, item=item, lock=lock)
File "/usr/local/lib/python3.5/dist-packages/feed2exec/plugins/wayback.py", line 34, in output
location = res.headers['Content-Location']
File "/usr/lib/python3/dist-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'content-location'
plugin generated exception: 'content-location', skipping
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/feed2exec/plugins/__init__.py", line 105, in output
return plugin.output(*args, feed=feed, item=item, lock=lock)
File "/usr/local/lib/python3.5/dist-packages/feed2exec/plugins/wayback.py", line 34, in output
location = res.headers['Content-Location']
File "/usr/lib/python3/dist-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'content-location'
It is unclear why this happens or how to reproduce, so I don't have a
unit test for this just yet. But we should guard against bad data
anyways, so handling missing headers is a good idea anyways.
↧