cmc-csci040
cmc-csci040 copied to clipboard
wardialing lab instructions problem
Hi Mike,
I believe there is a mistake in the instructions for the wardialing lab. I've been working on the last fixme for awhile and kept getting a "AttributeError: 'set' object has no attribute 'items'" error. It was happening on these two lines.
Traceback (most recent call last):
File "/Users/louiseschiele/Documents/vscode/wardiallab/wardial.py", line 44, in <module>
is_server_at_ip(ip)
File "/Users/louiseschiele/Documents/vscode/wardiallab/wardial.py", line 13, in is_server_at_ip
r = requests.get('http://'+ip, headers={'host', 'this can be anything :)'}, timeout=5)
I believe that in your step 4 of the instructions, it should be:
r = requests.get('http://'+ip, headers={'host' : 'this can be anything :)'}, timeout=5)
instead of what you have, which is:
r = requests.get('http://'+ip, headers={'host', 'this can be anything :)'}, timeout=5)
with the colon instead of the comma. I got this from this stack overflow post, where someone said that you need to use dictionaries for headers.
Good detective work! You're correct that I had a typo in instructions, and your solution is also correct :)