KeyError: 'link' in capture
See original GitHub issueWhen I was running this code:
$ python3.8 test_save.py
{'Server': 'nginx/1.15.8', 'Date': 'Wed, 15 Jul 2020 11:59:50 GMT', 'Content-Type': 'text/html', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache'}
capture: 42.963274240493774 sec.
{'Server': 'nginx/1.15.8', 'Date': 'Wed, 15 Jul 2020 12:01:37 GMT', 'Content-Type': 'text/html', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache'}
capture_or_cache: 97.4388906955719 sec.
Traceback (most recent call last):
File "test_save.py", line 28, in <module>
main()
File "test_save.py", line 24, in main
measure(fun, url)
File "test_save.py", line 8, in measure
print(f(*arg))
File "/home/eggplants/.pyenv/versions/3.8.0/lib/python3.8/site-packages/savepagenow/api.py", line 55, in capture
header_links = parse_header_links(response.headers['Link'])
File "/home/eggplants/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'link'
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Python KeyError Exceptions and How to Handle Them
The Python KeyError is a type of LookupError exception and denotes that there was an issue retrieving the key you were looking for....
Read more >Catch KeyError in Python - Stack Overflow
If it's raising a KeyError with no message, then it won't print anything. If you do... try: connection = manager.connect("I2Cx") except ...
Read more >Catch KeyError in Python - SyntaxFix
If I run the code: connection = manager.connect("I2Cx"). The program crashes and reports a KeyError because I2Cx doesn't exist (it should be I2C)....
Read more >How to Fix KeyError Exceptions in Python - Rollbar
The Python KeyError is an exception that occurs when an attempt is made to access an item in a dictionary that does not...
Read more >Python read MVNX script: KeyError - Xsens-BASE
Python read MVNX script: KeyError: 'footContacts' occurs when using the 'get_foot_contacts' command. When using the load_mvnx python script the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I needed to figure out a quick fix for this same problem, and I ended up writing this. It’s not the most exact or beautifully written piece of code in the world, but it works for my purposes. Maybe it’ll work for yours.
I’ve pushed a change as proposed here live in version 1.1.0. @dannguyen and @eggplants, tell me if it fixes things for you.
https://pypi.org/project/savepagenow/1.1.0/