예제 #1
0
파일: browser.py 프로젝트: chbrown/remoting
def phantomjs(script, args, socks_proxy_port=None, timelimit=60):
    # returns the <returncode> returned by phantomjs, or None if it timed out
    options = []
    if socks_proxy_port:
        options = ['--proxy-type=socks5', '--proxy=localhost:%s' % str(socks_proxy_port)]
    command = ['phantomjs'] + options + [script] + list(args)
    print '$ %s' % ' '.join(command)
    return timeout.run(subprocess.call, timelimit, command)
예제 #2
0
파일: socks.py 프로젝트: getwingm/remoting
def find_proxy(hostname_iterator, local_port):
    for hostname in hostname_iterator:
        process = timeout.run(start_proxy, 15, hostname, local_port)
        if process == None:
            # it must have timed out, other process would be a Popen process
            stderr('Tunnel creation timed out after 15s.')
        else:
            return process

    stderr('Could not find a valid hostname.')
    return None
예제 #3
0
def phantomjs(script, args, socks_proxy_port=None, timelimit=60):
    # returns the <returncode> returned by phantomjs, or None if it timed out
    options = []
    if socks_proxy_port:
        options = [
            '--proxy-type=socks5',
            '--proxy=localhost:%s' % str(socks_proxy_port)
        ]
    command = ['phantomjs'] + options + [script] + list(args)
    print '$ %s' % ' '.join(command)
    return timeout.run(subprocess.call, timelimit, command)