First of all, sorry for the vague title as I wasn't sure what to call it.
Here is the issue I'm having, I'm creating a dict structure like so:
requestDict["001"]["request"] = "GET / HTTP..."
requestDict["001"]["response"] = "HTTP 1.1 OK..."
etc.
But this isn't working
def fiddler_convert(filename):
archive = zipfile.ZipFile(filename, "r")
requestDict = {}
for name in archive.namelist():
if name.find(".txt") != -1:
requestNum = (name.split("_")[0]).split("/")[1]
requestDict[requestNum] = {}
if name.find("_c.txt"):
requestDict[requestNum]["request"] = archive.read(name)
elif name.find("_s.txt"):
requestDict[requestNum]["response"] = archive.read(name)
else:
print "wat"
for key, value in requestDict:
print key + ":" + value
archive.close()
I get an error of for key, value in requestDict:
ValueError: too many values to unpack
Why is this? The type of each value is just a string ie "001", "002", etc.
Wondering if anyone has any ideas? The input is all good (ie. requestNum variable is set correct to "001" and archive.read(name) is good).