Python Forum

Full Version: URL via raw_input, passed to HTTP requests and output?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.


Hey,

I'm new to Python and am trying to make a particular script.

What I am requiring is:

I input a URL via raw_input, then said URL is opened, and a string added on the end of the URL, from an array.
I need to add these strings to the end of URL's inputted from raw_input.

E.G:

I input "google.com" into raw_input, and I need it to one at a time (seperately), add the strings from the stuff aray on the end of the URL. I then need it to read the response from the site to determine if the string we sent is in the response and if it is; output the link.

How would I go about this?

What I have so far:

        br = mechanize.Browser()
        br.addheaders = [
            ('User-agent',
             'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11)Gecko/20071127 Firefox/2.0.0.11')]

        br.set_handle_robots(False)
        br.set_handle_refresh(False)

stuff = ["stuff1," "stuff2", "stuff3"]

results = []

site = raw_input("site:")
        if 'https://' in site:
            pass
        if 'http://' in site:
            pass
        else:
            site = "http://"+site
Request close