views:

21

answers:

0

I'm trying to use a proxy with Python's mechanize automated browser library but it doesn't seem to be working. I am trying the following and checking the output and its not getting the page. I have made sure I am testing with proxies that work as I test the proxy manually in my browser first. Any advice on proper syntax is appreciated as I just found this way (beloW) from another post and couldn't find much other info on this.

class someclass:

   def __init__(self):
            proxy = "193.169.87.153:3128"
            html = self.mechanize_proxy(proxy)


   def mechanize_proxy (self, proxy):
        self.o_mech = Mechanize_class()
        self.br = self.o_mech.br


        html = ''
        self.br.set_proxies({"http": proxy,
                        "ftp": proxy,
                        })

        r = self.br.open('http://www.ip-adress.com/', timeout=10)
        html = r.read()
        status=True