Jun-15-2019, 06:57 PM
Hello
I have an assignment where I need to write a script with a custom header with a x-api-key within a range of 5500-5600 to get a file. As it stands I don't even know if I set my variables or parameters correctly and whenever I've tried to run a loop to cycle it just doesn't run it. Anyone mind helping me and explaining what I am doing wrong or if I am even in the ballpark?
I have an assignment where I need to write a script with a custom header with a x-api-key within a range of 5500-5600 to get a file. As it stands I don't even know if I set my variables or parameters correctly and whenever I've tried to run a loop to cycle it just doesn't run it. Anyone mind helping me and explaining what I am doing wrong or if I am even in the ballpark?
import urllib2 x = 5558 customheader = {"x-api-key" : str(x)} url = "127.0.0.1:8082" request = urllib2.Request(url,"",customheader) response = urllib2.urlopen(request) html = response.read print(html)