打开 kookeey IP 代理平台,假如端口是 http://gate.kookeey.io:15959,账号: kookeey,密码: 12345678 )。
import urllib.request;
proxy = urllib.request.ProxyHandler({'https': 'http://kookeey:12345678@gate.kookeey.io:15959'})
opener = urllib.request.build_opener(proxy)
urllib.request.install_opener(opener)
content = urllib.request.urlopen('https://lumtest.com/myip.json').read();
print(content)
# -*- coding: utf-8 -*-
import time
import base64
import requests
import hmac
import hashlib
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class KEKPROXY(object):
def __init__(self):
super(KEKPROXY, self).__init__()
self.session = requests.session()
def get_proxy(self):
ti = str(time.time())[:10]
# ti = ti.strip('.')
print((ti))
token_ = str(base64.b64encode((hmac.new(bytes('开发者Token', encoding='utf-8'),bytes('p=1234567&ts={}'.format(ti).strip('&'), encoding='utf-8'),hashlib.sha1).hexdigest()).encode("utf-8")),encoding="utf-8")
print(token_)
proxy = self.session.get('https://kookeey.com/ip?accessid=开发者ID&signature={}&p=1234567&ts={}'.format(token_,ti),verify=False).text
print(proxy)
if __name__ == '__main__':
KEKPROXY().get_proxy()