def get_random_proxy(): client = RedisClient(host='45.117.101.219', password='') try: proxies = client.all() if 'adsl1' in proxies.keys(): proxies = proxies['adsl1'] else: return None return 'http://' + proxies except: return None
def __init__(self): global ready self.client = RedisClient(host='xxx', password='') self.ssh = paramiko.SSHClient() self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.ssh.connect(hostname='221.228.217.108', port=20304, username='******', password='******') stdin, stdout, stderr = self.ssh.exec_command('python3.4 adsl.py') result = stdout.read() result = result.decode()[:-1] self.proxy = result + ':8888' self.error = 0 ready = True
# -*- coding: utf-8 -*- from adslproxy import RedisClient import time client = RedisClient(host='47.107.227.145', port=6379, password='******', proxy_key='adsl') while True: time.sleep(1) try: random = client.random() all = client.all() names = client.names() proxies = client.proxies() count = client.count() # print('RANDOM:', random) print('ALL:', all) print('NAMES:', names) print('PROXIES:', proxies) print('COUNT:', count) except Exception as e: print(e)
# -*- coding: utf-8 -*- from adslproxy import RedisClient import json import time client = RedisClient(host='47.107.227.145', port=6379, password='******', proxy_key='QAItem') try: # random = client.random() all = client.all() with open('QAItem.json','w',encoding='utf-8') as f: f.write(json.dumps(all,ensure_ascii=False)) # print(all) except Exception as e: print(e)
from adslproxy import RedisClient client = RedisClient(host='', password='') random = client.random() all = client.all() names = client.names() proxies = client.proxies() count = client.count() print('RANDOM:', random) print('ALL:', all) print('NAMES:', names) print('PROXIES:', proxies) print('COUNT:', count)