def fake_clicks url user_agent accept_language referer None proxyline

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def fake_clicks(url, user_agent, accept_language, referer=None, proxyline=None):
stub_host = urlsplit(url).hostname
profile = FirefoxProfile(PROFILE_PATH)
profile.set_preference("general.useragent.override", user_agent)
profile.set_preference('intl.accept_languages', accept_language)
if proxyline:
print 'SETTING UP PROXY %s' % proxyline
server, port = proxyline.split(':')
#profile.set_preference("network.proxy.http", server)
#profile.set_preference("network.proxy.http_port", int(port))
profile.set_preference("network.proxy.socks", server)
profile.set_preference("network.proxy.socks_port", int(port))
profile.set_preference("network.proxy.type", 1)
profile.set_preference('network.http.connect.timeout', 30)
profile.set_preference('network.http.request.timeout', 30)
profile.set_preference('network.http.keep-alive.timeout', 30)
profile.set_preference('network.proxy.no_proxies_on', 'localhost, 127.0.0.1, google.co.uk')
profile.update_preferences()
browser = webdriver.Firefox(firefox_profile=profile)
pid = browser.binary.process.pid