Click here to Skip to main content
15,915,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello there,
I recently downloaded a linux ubuntu, and I was asked to send out a request that will return me the state of a zip code given by the user and sent to a website that is in the code itself and pritn the state.

for some odd reason when I try to run the code I written it stopps at r = req.prepare()

And this is after I downloaded the request moudle (sudo apt-get install python-pip) which was suppose to be $ pip install requests.

So what do I need to do In order to send this get request successfuly?



Python
from scapy.all import *
from random import randint
import requests
import urllib 








def main():

    

    
    

    for i in range(0,1):
        print "Please enter the mikud"
	#mikud = raw_input()
	address = r"http://www.uszip.com/zip/04966"
	#address+= mikud
	
	
        req = requests.Request('GET', address)
	r = req.prepare()
	s = requests.Session()
	back = s.send(r)
	
	print req
	print r
	print s
	print back
	
	
	
	if (req):
	    print "its real"
	    
	   

	else:
	    print "mikud is not real"

        




if __name__ == '__main__':
    main()
Posted
Updated 11-Dec-15 5:23am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900