Custom Search

Friday, May 2, 2014

How to python google recaptcha via proxy

How to python google recaptcha via proxy

1)
Method1


RECAPTCHA_PROXY = 'http://ip-of-proxy-server:3128'

recaptcha_proxy = getattr(settings, "RECAPTCHA_PROXY", None)
if recaptcha_proxy:
    proxy = urllib2.ProxyHandler({
        'http': recaptcha_proxy,
        'https': recaptcha_proxy
    })
    opener = urllib2.build_opener(proxy)
    urllib2.install_opener(opener)


2)
Method2

import os
os.environ['http_proxy'] = 'http://ip-of-proxy-server:3128'
os.environ['https_proxy'] = os.environ['http_proxy']

No comments:

Post a Comment