Python Forum
URL via raw_input, passed to HTTP requests and output?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URL via raw_input, passed to HTTP requests and output?
#1


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
Reply
#2
Request close
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 345 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  detecting a generstor passed to a funtion Skaperen 9 3,605 Sep-23-2021, 01:29 AM
Last Post: Skaperen
  how to modify a variable that is passed as parameter StefanL38 2 2,117 Dec-07-2020, 08:39 AM
Last Post: StefanL38
  Going thru tutorials..."NameError: name 'raw_input' is not defined" hmonnier 4 4,238 Jul-14-2020, 02:19 PM
Last Post: BitPythoner
  ModuleNotFoundError: No module named 'http.client'; 'http' is not a package abhishek81py 1 15,461 Jun-25-2020, 08:58 AM
Last Post: buran
  are numeric types passed by value or reference? rudihammad 4 2,623 Nov-19-2019, 06:25 AM
Last Post: rudihammad
  raw_input vs input EmilySenechal 1 2,361 Nov-20-2018, 02:13 AM
Last Post: ichabod801
  raw_input rtbr17 3 3,688 Sep-26-2018, 09:36 PM
Last Post: nilamo
  Is there a way to append to a list WITHOUT modifying the parameter passed? arnavb 11 5,706 Sep-23-2018, 07:16 AM
Last Post: Skaperen
  Help in understanding scope of dictionaries and lists passed to recursive functions barles 2 3,209 Aug-11-2018, 06:45 PM
Last Post: barles

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020