How to use url_encode method in hypothesis

Best Python code snippet using hypothesis

test.py

Source:test.py Github

copy

Full Screen

1# _*_ coding: utf-8 _*_2import platform3print(platform.node())4climb_wall_proxies_dict = {5 'czMacBook-Pro.local':{6 'http':'http://127.0.0.1:49290', #84667 'https':'https://127.0.0.1:49290',8 },9 'MaoMao': {10 'http':'http://127.0.0.1:8466', #846611 'https':'https://127.0.0.1:8466',12 },13}14climb_wall_proxies = climb_wall_proxies_dict.get(15 platform.node(),16 {17 'http':'http://127.0.0.1:8466', #846618 'https':'https://127.0.0.1:8466',19 }20 )21phproxylist = [22 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '亚太地区 ',23 'baseurl': 'http://www.kn.com.my/modules/mod_syndicate/license.php', 'hl': '3ed#', 'url_encode': 'base64',24 'note': None, 'method': 'GET', 'ip': '103.50.164.54', 'wall': 0},25 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',26 'baseurl': 'http://amra.ga/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET',27 'ip': '107.158.239.58', 'wall': 0},28 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '罗马尼亚 ',29 'baseurl': 'http://www.didaxis.org/site/language/pdf_fonts/search.php', 'hl': '3ed#', 'url_encode': 'base64',30 'note': None, 'method': 'GET', 'ip': '109.199.99.74', 'wall': 0,'needtest':0},31 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '荷兰 ',32 'baseurl': 'http://www.codehacker.nl/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,33 'method': 'POST', 'ip': '109.70.1.44', 'wall': 1 ,'needtest':0},34 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '新加坡 ',35 'baseurl': 'http://www.ipchicken.in/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,36 'method': 'POST', 'ip': '111.221.46.163', 'wall': 0},37 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '香港 电讯盈科有限公司',38 'baseurl': 'https://www.hypernite.com/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,39 'method': 'GET', 'ip': '116.49.155.70', 'wall': 0,'needtest':0},40 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '新加坡 Digital Ocean股份有限公司数据中心',41 'baseurl': 'http://pdiperjuangan-diy.org/wp-includes/error.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,42 'method': 'GET', 'ip': '128.199.88.81', 'wall': 0},43 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q',44 'address': '澳大利亚 Sugar Research Institute', 'baseurl': 'https://www.configinter.net/hide-proxy/index.php',45 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET', 'ip': '139.59.107.129', 'wall': 0},46 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '日本 ',47 'baseurl': 'http://jien.net/gim/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'POST',48 'ip': '150.95.8.132', 'wall': 0},49 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '英国 ',50 'baseurl': 'http://www.pitchoo.net/zob_/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,51 'method': 'GET', 'ip': '163.172.46.116', 'wall': 0},52 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 密苏里州堪萨斯城virpus网络公司',53 'baseurl': 'http://www.proxy.gunhotnews.com/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,54 'method': 'GET', 'ip': '173.0.51.131', 'wall': 0},55 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 亚利桑那州斯科茨代尔市Go Daddy集团公司',56 'baseurl': 'http://greenpowerguy.com/blog/wp-content/themes/error.php', 'hl': '3ed#', 'url_encode': 'base64',57 'note': None, 'method': 'GET', 'ip': '173.201.196.58', 'wall': 0},58 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 犹他州盐湖城Bluehost公司',59 'baseurl': 'http://dmburke.com/PHPProcksy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,60 'method': 'GET', 'ip': '173.254.28.144', 'wall': 0},61 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 亚利桑那州斯科茨代尔市Go Daddy集团公司',62 'baseurl': 'http://fgks.org/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': '多IP,44,200,203,206', 'method': 'GET',63 'ip': '184.168.46.203', 'wall': 0,'needtest':1},64 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '欧洲和中东地区 ',65 'baseurl': 'https://gimmes.net/proxy/index.php', 'hl': '8#', 'url_encode': 'base64', 'note': None,66 'method': 'GET', 'ip': '185.114.157.172', 'wall': 0,'needtest':0},67 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '立陶宛 ',68 'baseurl': 'http://charliefrancis.cf/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,69 'method': 'GET', 'ip': '185.28.20.15', 'wall': 0},70 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '新加坡 Digital Ocean股份有限公司数据中心',71 'baseurl': 'https://frascar.uk/secret/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,72 'method': 'GET', 'ip': '188.166.173.128', 'wall': 0},73 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',74 'baseurl': 'https://www.fast-autolikers.com/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,75 'method': 'GET', 'ip': '192.185.4.67', 'wall': 0},76 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '俄罗斯 ',77 'baseurl': 'http://hoponhopoff.ge/errors.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET',78 'ip': '194.190.8.178', 'wall': 0},79 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 ',80 'baseurl': 'http://f8ip.toile-libre.org/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': '不能用蓝灯',81 'method': 'POST', 'ip': '195.88.84.74', 'wall': 0},82 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '加拿大 ',83 'baseurl': 'https://yxorp.pandemonium.ovh/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,84 'method': 'POST', 'ip': '198.245.60.86', 'wall': 0},85 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '加拿大 ',86 'baseurl': 'http://efintel.cl/wp-includes/error.php', 'hl': '2c0', 'url_encode': 'base64', 'note': None,87 'method': 'POST', 'ip': '198.50.180.210', 'wall': 0},88 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 巴黎OV',89 'baseurl': 'http://www.decret-pinel.fr/wp-includes/error.php', 'hl': '3ed#', 'url_encode': 'base64',90 'note': '原始网页丢失结尾部分字符,可能造成解析错误', 'method': 'GET', 'ip': '213.251.182.111', 'wall': 0},91 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '匈牙利 ',92 'baseurl': 'http://totalfish.hu/errors.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET',93 'ip': '217.20.130.216', 'wall': 0},94 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 ',95 'baseurl': 'http://dev.chamoun.fr/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,96 'method': 'GET', 'ip': '217.70.186.133', 'wall': 0},97 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '香港 电讯盈科有限公司',98 'baseurl': 'http://www.taiwangoodbuy.com/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,99 'method': 'GET', 'ip': '223.197.160.25', 'wall': 0},100 {'strip_tail': '<!-- Yandex.Metrika counter -->', 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q',101 'address': '俄罗斯 ', 'baseurl': 'http://free.lynx.net.ru/index.php', 'hl': '3ed#', 'url_encode': 'base64',102 'note': None, 'method': 'GET', 'ip': '37.9.135.169', 'wall': 0},103 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 OVH SAS',104 'baseurl': 'https://cajs.co.uk/proxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,105 'method': 'GET', 'ip': '46.105.120.135', 'wall': 0},106 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '荷兰 ',107 'baseurl': 'http://www.flatertheek.nl/wp-includes/SimplePie/HTTP/search.php', 'hl': '3ed#', 'url_encode': 'base64',108 'note': None, 'method': 'POST', 'ip': '46.235.42.55', 'wall': 1},109 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '捷克 ',110 'baseurl': 'http://ubytovnaukasny.cz/errors.php', 'hl': '48', 'url_encode': 'base64', 'note': None,111 'method': 'GET', 'ip': '46.28.105.82', 'wall': 0,'needtest':0},112 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 亚利桑那州斯科茨代尔市Go Daddy集团公司',113 'baseurl': 'http://themansphere.com/wp-includes/error.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': '多IP,173,175',114 'method': 'POST', 'ip': '50.63.194.175', 'wall': 0,'needtest':1},115 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 华盛顿州西雅图市亚马逊(Amazon)公司数据中心',116 'baseurl': 'https://symbiose-proxy.herokuapp.com/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,117 'method': 'POST', 'ip': '54.170.27.88', 'wall': 0},118 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '北美地区 ',119 'baseurl': 'http://p.webbled.com/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET',120 'ip': '66.175.239.1', 'wall': 0},121 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 ',122 'baseurl': 'http://www.dynit.it/edit-link.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'POST',123 'ip': '78.46.179.12', 'wall': 0},124 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 ',125 'baseurl': 'http://www.weisfeltlintz.nl/wordpress_1/tmp/search.php', 'hl': '3ed#', 'url_encode': 'base64',126 'note': None, 'method': 'POST', 'ip': '78.47.90.57', 'wall': 0},127 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '英国 ',128 'baseurl': 'http://79.170.40.227/splashextend.co.uk/downloads/index.php', 'hl': '3ed#', 'url_encode': 'base64',129 'note': None, 'method': 'GET', 'ip': '79.170.40.227', 'wall': 0},130 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '英国 ',131 'baseurl': 'http://79.170.44.126/kingvisphostdemo.co.uk/downloads/vpn/index.php', 'hl': '3ed#',132 'url_encode': 'base64', 'note': None, 'method': 'POST', 'ip': '79.170.44.126', 'wall': 1},133 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 柏林Strato公司',134 'baseurl': 'http://qartex.com/webproxy/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None,135 'method': 'POST', 'ip': '81.169.144.135', 'wall': 0},136 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '比利时 ',137 'baseurl': 'http://www.tkofschip.be/joomlasites/ankerintranet5/plugins/content/config.index.php', 'hl': '3ed#',138 'url_encode': 'base64', 'note': None, 'method': 'POST', 'ip': '81.82.233.220', 'wall': 0},139 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 巴黎OVH SAS数据中心',140 'baseurl': 'http://p.kristof.123.fr/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'POST',141 'ip': '91.121.167.136', 'wall': 0},142 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '保加利亚 ',143 'baseurl': 'http://xawos.ovh/index.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'POST',144 'ip': '91.134.135.179', 'wall': 0},145 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 俄亥俄州哥伦布市IXwebhosting',146 'baseurl': 'http://toarabic.net/default.php', 'hl': '3ed#', 'url_encode': 'base64', 'note': None, 'method': 'GET',147 'ip': '98.130.2.33', 'wall': 0,'needtest':0},148 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 宾州费城PHL数据中心',149 'baseurl': 'http://www.proxyweb.online/index.php', 'hl': '3ed', 'url_encode': 'base64', 'note': None, 'method': 'GET',150 'ip': '162.243.50.61', 'wall': 0, 'needtest':0},151 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '北京联通',152 'baseurl': 'http://fantaluciano.altervista.org/poste/index.php', 'hl': '3ed', 'url_encode': 'base64', 'note': None,153 'method': 'POST',154 'ip': '114.241.70.59', 'wall': 1, 'needtest': 0,'block':1},#无法访问,浏览器可以访问155 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '捷克 ',156 'baseurl': 'http://proxy.polach.info/index.php', 'hl': '48', 'url_encode': 'base64',157 'note': None,158 'method': 'POST',159 'ip': '', 'wall': 1, 'needtest': 0,'block':1}, #无法访问160 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '罗马尼亚 ',161 'baseurl': 'http://www.semneartemis.ro/errors.php', 'hl': '40', 'url_encode': None,162 'note': '使用base编码url会出错',163 'method': 'GET',164 'ip': '176.223.125.70', 'wall': 0,'needtest': 0, 'block': 0},165 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',166 'baseurl': 'https://4alltools.com/en/webproxy/index.php', 'hl': '0', 'url_encode': None,167 'note': '使用base编码url会出错',168 'method': 'GET',169 'ip': '192.254.156.235', 'wall': 0, 'needtest': 0, 'block': 0},170 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',171 'baseurl': 'https://pan.one/proxy/index.php', 'hl': '7cd', 'url_encode': None,172 'note': '不能使用base编码url会出错',173 'method': 'GET',174 'ip': '107.182.176.206', 'wall': 0,'needtest': 0, 'block': 0},175 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 ',176 'baseurl': 'https://www.sslgate.co.uk/index.php', 'hl': '3ed', 'url_encode': 'base64',177 'note': '',178 'method': 'GET',179 'ip': '212.227.127.19', 'wall': 1, 'needtest': 0, 'block': 0,'ssl':False},180 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '丹麦 ',181 'baseurl': 'http://aalogic.se/error.php', 'hl': '3ed', 'url_encode': 'base64',182 'note': '',183 'method': 'GET',184 'ip': '212.97.134.13', 'wall': 0, 'needtest': 0, 'block': 0,},185 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 ',186 'baseurl': 'http://bypass.osiland.com/index.php', 'hl': '3ed', 'url_encode': 'base64',187 'note': '',188 'method': 'GET',189 'ip': '212.227.24.37', 'wall': 1, 'needtest': 0, 'block': 0, },190 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 华盛顿州西雅图市亚马逊(Amazon)公司数据中心',191 'baseurl': 'http://filterevade.com/index.php', 'hl': '3ed', 'url_encode': 'base64',192 'note': '',193 'method': 'GET',194 'ip': '54.208.158.42', 'wall': 1, 'needtest': 0, 'block': 0, },195 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',196 'baseurl': 'http://jelajah.internetmerdeka.org/index.php', 'hl': '3ed', 'url_encode': 'base64',197 'note': '',198 'method': 'GET',199 'ip': '104.37.169.89', 'wall': 1, 'needtest': 0, 'block': 0, },200 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '日本 ',201 'baseurl': 'http://kochiya.rosx.net/kushi/index.php', 'hl': '3ed', 'url_encode': 'base64',202 'note': '',203 'method': 'GET',204 'ip': '27.96.40.195', 'wall': 1, 'needtest': 0, 'block': 0, },205 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 巴黎OVH系统公司',206 'baseurl': 'http://prox.emobilis.com/index.php', 'hl': '3ed#', 'url_encode': 'base64',207 'note': '',208 'method': 'POST',209 'ip': '213.251.182.103', 'wall': 1, 'needtest': 0, 'block': 0, },210 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '加拿大 魁北克省蒙特利尔市OVH数据中心',211 'baseurl': 'http://proxy.fotserv.pl/index.php', 'hl': '3ed#', 'url_encode': 'base64',212 'note': '',213 'method': 'POST',214 'ip': '142.4.211.204', 'wall': 1, 'needtest': 1, 'block': 0, },215 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 犹他州盐湖城Bluehost公司',216 'baseurl': 'http://proxy.ske.ind.in/index.php', 'hl': '3ed', 'url_encode': 'base64',217 'note': '',218 'method': 'GET',219 'ip': '73.254.28.103', 'wall': 1, 'needtest': 1, 'block': 0, },220 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '捷克 ',221 'baseurl': 'http://prx.afkcz.eu/prx/index.php', 'hl': '3ed', 'url_encode': 'base64',222 'note': '',223 'method': 'POST',224 'ip': '46.28.105.7', 'wall': 1, 'needtest': 1, 'block': 0, },225 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 纽约市DigitalOcean云公司',226 'baseurl': 'http://surfean2.kreotuweb.com/index.php', 'hl': '3ed', 'url_encode': 'base64',227 'note': '',228 'method': 'GET',229 'ip': '104.236.101.154', 'wall': 1, 'needtest': 1, 'block': 0, },230 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 宾夕法尼亚州切斯特县切斯特布鲁克1&1互联网公司',231 'baseurl': 'http://truthsilo.com/pox/index.php', 'hl': '3ed', 'url_encode': 'base64',232 'note': '',233 'method': 'POST',234 'ip': '74.208.180.26', 'wall': 1, 'needtest': 1, 'block': 0, },235 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 得克萨斯州普莱诺市Layered科技公司',236 'baseurl': 'http://vrecon.com/index.php', 'hl': '3ed', 'url_encode': 'base64',237 'note': '',238 'method': 'POST',239 'ip': '74.200.236.197', 'wall': 1, 'needtest': 1, 'block': 0, },240 {'strip_tail': None, 'strip_head': 'ocument.write("', 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 巴黎OVH',241 'baseurl': 'http://www.imzi-tours-travel.com/annuaire/index.php', 'hl': '3ed', 'url_encode': 'base64',242 'note': '尾部不完整',243 'method': 'POST',244 'ip': '13.251.182.110', 'wall': 1, 'needtest': 1, 'block': 0, },245 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '新加坡 Go Daddy 有限公司新加坡数据中心',246 'baseurl': 'http://www.duckproxy.com', 'hl': '3ed', 'url_encode': 'base64',247 'note': '',248 'method': 'GET',249 'ip': '182.50.135.77', 'wall': 1, 'needtest': 1, 'block': 0, },250 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '法国 巴黎OVH',251 'baseurl': 'http://www.thely.fr/proxy/index.php', 'hl': '3ed', 'url_encode': 'base64',252 'note': '',253 'method': 'POST',254 'ip': '213.251.182.110', 'wall': 1, 'needtest': 1, 'block': 0, },255 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 ',256 'baseurl': 'http://www.ultrabestproxy.com/index.php', 'hl': '3ed', 'url_encode': 'base64',257 'note': '',258 'method': 'GET',259 'ip': '209.126.107.97', 'wall': 1, 'needtest': 1, 'block': 0, },260 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 宾夕法尼亚州切斯特县切斯特布鲁克1&1互联网公司',261 'baseurl': 'http://www.worryfreecomputers.com/tube/index.php', 'hl': '3ed', 'url_encode': 'base64',262 'note': '',263 'method': 'GET',264 'ip': '74.208.16.73', 'wall': 1, 'needtest': 1, 'block': 0, },265 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '美国 犹他州盐湖城Bluehost公司',266 'baseurl': 'http://www.dmburke.com/PHPProcksy/index.php', 'hl': '3ed', 'url_encode': 'base64',267 'note': '',268 'method': 'GET',269 'ip': '173.254.28.144', 'wall': 0, 'needtest': 1, 'block': 0, },270]271'''272http://103.1.172.112/archieves/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=e9# 182.50.142.233273http://62.109.25.136/index.php?q=uggc%3A%2F%2Fvc.puvanm.pbz%2Ftrgvc.nfck&hl=2fd 62.109.25.136 尾部广告274http://71.18.69.108/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 翻墙 50.6.77.49275http://89.163.130.223/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.222276http://anonymizer.in/anonymizer/ 网页似乎是错的277http://arne-post.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 91.136.8.9278http://basit.work/index.php 翻墙 184.168.46.89279http://bbsq.us/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3eb# 149.56.203.152280http://codehacker.nl/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 109.70.1.44281http://endo.gr/endomembers/proxy/nc/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 95.154.242.224 有人机验证,需破解282http://fitnessdepotprices.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 67.213.82.137283http://fuckgema.net/index.php?q=uggc%3A%2F%2Fvc.puvanm.pbz%2Ftrgvc.nfck&hl=2fd 198.71.226.39284http://fzsky.sitemix.jp/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 内部错误285http://gxu.free.fr/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 连接错误286http://hamedweb.persiangig.com/Anonpass.com%20-%20Free%20Anonymous%20Proxy%20Site.htm 嵌入一个链接,Anonpass.com 可用 url form287http://herosurf.net/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 91.205.174.23288http://hideip.pro.composesite.com/ 有类似站点信息289http://hidemyfree.com/index.php 不跳转290http://homeschool.noip.me/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 65.175.144.121291http://ilike.ga/index.php 500错292http://iphider.org/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=36c# 192.99.4.37 域名 74.117.182.141293http://itwtf.com/index.php?q=y6qm1GtmZqLTYZWezNSTrmSaos5lyZ7XzKljlKihrw 45.33.6.150 特殊引擎,非PHProxy This php-proxy service remains free to use. Subject to local laws.294http://khs54915.tripod.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# index.php 丢失?295http://leather-bg.com/index.php 打不开296http://matusik.net/bramka/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 176.97.143.154297http://mob.beproxy.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 184.168.27.152298http://mysyrian.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 193.202.110.20299http://navegasinley.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ef# 178.33.112.8300http://nicetrick.info/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 149.210.154.141301http://odblokuj.115zse.frih.net/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 144.76.111.228302http://offeng.com/ch00/Proksy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 勉强可以抢救 http://ip.chinaz.com/getip.aspx{ip:'74.220.207.198',address:'缇庡浗 鐘逛粬宸炵洂婀栧煄Bluehost鍏徃'}303http://panyuxin.com/proxy/index.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=481# 107.182.176.206304http://phproxy.nfriedly.com/index.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=2e1# 54.161.254.69305http://pinkpanda.comuv.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 153.92.0.7306http://plany.fasthosting.it/test/index.php 不能跳转307http://portal.free4viet.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 103.9.158.194308http://pr0xi3s.ga/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 178.32.102.34 有尾部广告309http://proxy.eglovers.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 404310http://proxy.filipe.ch/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 88.198.41.182311http://proxy.gunhotnews.com/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed 173.0.51.131312http://proxy.scorpimen.eu/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 188.116.9.91313http://proxy.twista.cz/subdom/proxy/index.php 可访问京东评论 46.28.105.24捷克314http://proxymesilly.net/315http://proxy-vault.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=7b# 198.255.10.170316http://raveandlaser.online/ 402317http://rhythmusic.net/De1337/nothing/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed#318http://showvision.info/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 184.168.27.152319http://soke.za.org/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 104.128.238.184320http://sure.i-t.me/blow.php/zVOlWSdJ/oet_2Bcc/0_2BNhgu/jHYllBjA/0g8YkREK/b1/fnorefer 188.116.19.33321http://surfanon.net/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 64.85.160.49322http://theproxyfree.com 网页似乎是错的323http://trubadix.myds.me/ppp/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 90.146.201.130324http://unafraid.epbsoft.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3cf 188.116.19.33325http://unblocked.in/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 95.154.222.196326http://unblockme.comuf.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 153.92.0.3327http://vincentgodefroy.free.fr/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 连接错误328http://webproxy.com glype 站点 有人机验证 {ip:'69.46.0.196',address:'美国 佛罗里达州坦帕市Hivelocity Ventures公司'}329http://worka.work/index.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=481# 184.168.27.152 抢救回来的330http://ww.297m.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 185.27.134.46331http://www.1proxy.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.148.111332http://www.2proxy.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.154333http://www.3proxy.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.161334http://www.4proxy.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.187335http://www.7soft.net/xx/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 138.201.197.73336http://www.blue-nil.net/pro/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 37.187.28.130337http://www.boffjenkins.co.uk/poxy.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=1ed 90.206.218.216 页面广告多,前后都有垃圾338http://www.cliker.com/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 62.149.141.127339http://www.djezzy.ml/index.php?a=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 54.242.114.76340http://www.ekzi.com/p/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed 只能从土耳其访问?341http://www.fevza.com/proxy/unblock-sites.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed 94.176.239.74342http://www.giantmania.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 178.254.57.13343http://www.hell-man.de/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=1fd# 82.100.220.35344http://www.infosid.com/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 31.220.20.28345http://www.jkworkshop.com/px12345/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 103.255.250.132346http://www.justproxy.co.uk/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 178.79.138.160347http://www.li-cai.com.tw/webjump/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 124.150.132.27348http://www.new-proxy.com.de/index.php 翻墙 89.163.130.236 德国349http://www.ohmymind.com/myp/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 403350http://www.openvpnvps.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 91.216.107.189351http://www.openwebdesign.org/design/3886/phproxy/ 网页似乎是错的352http://www.profitgyan.com/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 50.28.34.116353http://www.profitgyan.com/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 50.28.34.116354http://www.proproxy.me/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 37.187.65.43355http://www.proxy4me.com/phpproxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D 188.116.19.33 貌似最干净356http://www.proxyaka.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 188.227.186.64357http://www.proxyboost.net/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 149.210.148.6 域名 46.82.174.68358http://www.proxyghost.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 412359http://www.proxygratuits.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 翻墙 66.175.239.37360http://www.testesuainternet.com.br/tsi/proxy/index.php 可访问京东评论,速度貌似挺快,但不能访问查地址的页361http://www.theprofissional.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 193.202.110.22362http://www.vigoob.com/index.php 似乎是跳转错误363http://www.vrecon.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=a# 74.200.236.197364http://www.webproxy-germany.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.235365http://www.www2.dek-sara.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 150.107.31.52366http://www.wxfq.tk/index.php?q=moBrrgvF7Y7Dqbv4MV4K1E2r8bneRD79IfmV0ehddUjorZen&hl=5ef 54.172.21.101 编码奇特367https://carbonsecure.org/opennic-proxy/ 连接错误368https://descris.ro/shell/pass/script-loader.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=2c0# 89.46.7.240 域名 176.223.124.23369https://hidefrom.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 89.221.210.144 91.205.174.23370https://phproxy.herokuapp.com/index.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=2e1# 54.161.254.69371https://px.multiscreensite.com/index.php?url=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=0# 54.175.166.83372https://quickbypass.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed 返回空白373https://wecanunblock.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 89.221.210.144374https://www.4alltools.com/en/webproxy/index.php?q=http%3A%2F%2Fip.chinaz.com%2Fgetip.aspx&hl=2e5# 192.254.156.235375https://www.best-proxy.com.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.193 ssl376https://www.cajs.co.uk/proxy/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 46.105.120.135377https://www.fastfreewebproxy.tk/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 204.44.85.116 要求屏蔽ADBlock378https://www.german-webproxy.de/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 89.163.130.227 ssl 有错379https://www.iphider.org/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=36c# 192.99.4.37380https://www.justproxy.co.uk/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=2ed# 178.79.138.160381https://www.panyuxin.com/proxy/ 跳转到 https://pan.one/proxy/index.php382https://www.surf100.com/ 网页似乎是错的383http://soke.za.org/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed# 104.128.238.184384https://proxy.wehaa-server4.com/index.php?q=aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed385'''386import requests387from proxypool.utils import get_headers388import json,base64,urllib.parse389import time,base64390from pyquery import PyQuery as pq391import socket392def getIp(domain):393 def __getIp(domain):394 try:395 return socket.getaddrinfo(domain,'http')[0][4][0]396 except Exception as e:397 return '0'398 ip = __getIp(domain)399 count = 0400 while ip == '0':401 if __getIp('www.baidu.com') == '0':402 time.sleep(1)403 count += 1404 else:405 ip = __getIp(domain)406 break407 if count > 180:408 ip = '0'409 break410 return ip411def gethost(url):412 return urllib.parse.urlparse(url).netloc413def getscheme(url):414 return urllib.parse.urlparse(url).scheme415def getpath(url):416 return urllib.parse.urlparse(url).path417def getbaseurl(url):418 return getscheme(url) +'://' + gethost(url) + getpath(url)419def getmethod(pq_form):420 method = pq_form.attr.method421 action = pq_form.attr.action422 inputs = pq_form('input')423 payload = {}424 postreq = {}425 for input in inputs.items():426 name = input.attr.name427 p_type = input.attr.type428 if p_type == 'text':429 payload[name] = '__inputbox__'430 postreq['input'] = name431 #ToDo 如果有多个输入框,这里会有问题432 elif p_type == 'checkbox':433 payload[name] = 'on' if input.attr.checked == 'checked' else ''434 elif p_type == 'hidden':435 payload[name] = input.attr.value436 elif p_type == 'submit' and name != None:437 if postreq.get('submit',None) == None:438 postreq['submit'] = {}439 postreq['submit'][name] = input.attr.value440 #payload[name] = input.attr.value #多按钮情况下有用441 #print(payload,action,method)442 postreq['payload'] = payload443 postreq['action'] = action444 postreq['method'] = method445 #print(postreq)446 return postreq447def getformstr(text):448 forms = ''449 while True:450 pos = text.find('<form')451 if pos == -1:452 break453 posend = text[pos:].find('</form>')+len('</form>')454 if posend == -1:455 break456 #print(pos,posend)457 forms += text[pos:posend]458 #print(forms)459 text = text[posend:]460 #print(text)461 #print('aaaa',forms)462 return forms463def updateproxy(proxy,encode,mode = 'GET',headers = None,reqdata={},ssl=1,well=0,title='',hl='3ed#'):464 proxies = climb_wall_proxies if well == 1 else 0465 headers = headers or {466 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',467 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6',468 'Accept-Encoding': 'gzip, deflate, sdch',469 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',470 'Upgrade-Insecure-Requests': '1',471 'Cache-Control': 'max-age=0',472 'Connection': 'keep-alive',473 #'Host':'www.ip-adress.com',474 #'Cookie':'flags=3ed',475 #'origin':url,476 'Referer':getbaseurl(proxy.get('baseurl')),477 #':authority':url.replace('http://','').replace('https://',''),478 #':method':'POST',479 #':path':'/index.php',480 #':scheme':'https'481 }482 wellstr = '翻墙' if well == 1 else ''483 sslstr = '忽略SSL校验错误' if ssl == 0 else ''484 checkip = 'http://ip.chinaz.com/getip.aspx'485 #checkip = 'https://club.jd.com/comment/skuProductPageComments.action?callback=fetchJSON_comment98vv3306&productId=4250886&score=0&sortType=6&page=2&pageSize=10&isShadowSku=0&fold=1'486 baseurl = proxy.get('baseurl')487 #rint(baseurl,reqdata)488 t = time.time()489 conn = requests.session()490 try:491 if mode == 'FORM': #使用网页的对话框参数492 action = reqdata.get('action', getpath(baseurl))493 if action == None:494 action = getpath(baseurl)495 reqdata['action'] = action496 q = reqdata.get('input', 'q')497 posturl = gethost(baseurl) + '/' + action498 posturl = getscheme(baseurl) + '://' + posturl.replace(r'//', r'/')499 print(posturl)500 payload = reqdata.get('payload')501 payload[q] = checkip502 req = conn.post(url = posturl ,proxies=proxies,data=payload,headers=headers,verify=getSSL(ssl),timeout=20)503 else: #'GET504 # ToDo Get方式下需编码payload里面的参数505 if encode == 1:506 url = urllib.parse.quote_from_bytes(base64.b64encode(checkip.encode('utf8')))507 else:508 url = urllib.parse.quote_from_bytes(checkip.encode('utf8'))509 #使用Get方式时,不同的站点差别较大,需要用不同的脚本解决,这里暂时只支持PHProxy510 geturl = r'{}?{}={}&hl={}'.format(baseurl, 'q', url, hl)511 req = requests.get(url = geturl,proxies=proxies,headers=headers,verify=getSSL(ssl),timeout=10)512 if req.status_code != 200:513 print(req.status_code)514 text = req.text515 print(req.url)516 #print(text)517 #sslagree518 if 'sslagree' in text:519 '''520 <html>521 <head>522 <title>Security Warning</title>523 <style type="text/css">524 html, body {525 background: #0b1933;526 text-align: center;527 }528 body {529 font: 80% Tahoma;530 }531 #wrapper {532 margin: 100px auto;533 width: 500px;534 text-align: left;535 background: #fff;536 padding: 10px;537 border: 5px solid #ccc;538 }539 form {540 text-align: center;541 }542 </style>543 <base href="http://gameproxy.org/">544 </head>545 <body>546 <div id="wrapper">547 <h1>Warning!</h1>548 <p>The site you are attempting to browse is on a secure connection. This proxy is not on a secure connection.</p>549 <p>The target site may send sensitive data, which may be intercepted when the proxy sends it back to you.</p>550 <form action="includes/process.php" method="get">551 <input type="hidden" name="action" value="sslagree">552 <input type="submit" value="Continue anyway...">553 <input type="button" value="Return to index" onclick="window.location='.';">554 </form>555 <p><b>Note:</b> this warning will not appear again.</p>556 </div>557 </body>558 </html>559 '''560 print('-----------',text)561 print('sslagree')562 #req = conn.get(baseurl + 'includes/process.php',proxies=proxies,params=ppp,headers=headers,verify=getSSL(ssl))563 req = conn.get(url = posturl,proxies=proxies,params={'action:sslagree'},headers=headers,verify=getSSL(ssl),timeout=20)564 text = req.text565 #print(text)566 except Exception as e:567 print(e)568 return 0569 if "{ip:'" in text:570 def getstr(text,start,end):571 pos = int(text.find(start) + len(start))572 posend = int(text[pos:].find(end))+pos573 return text[pos:posend]574 print(title, req.url,wellstr,sslstr)575 et = time.time() - t576 print(' ',et, mode, len(text), text[:100].replace('\n', '').replace('\r', ''))577 ip = getstr(text,"{ip:'","',address:'" )578 address = getstr(text,"',address:'","'}")579 #print(' ',ip,address)580 '''581 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '德国 ',582 'baseurl': 'http://www.weisfeltlintz.nl/wordpress_1/tmp/search.php', 'hl': '3ed#',583 'url_encode': 'base64',584 'note': None, 'method': 'POST', 'ip': '78.47.90.57', 'wall': 0},585 '''586 if len(address) < 2 :address = '网页可能有错误'587 if len(ip) > 7 and len(address) > 2:588 ipset = proxy.get('mutil_ip',None)589 if ipset == None:590 proxy['mutil_ip'] = {}591 ipset = proxy.get('mutil_ip', None)592 ipset[ip] = address593 #print(ip, '---', address)594 strip_head = ''595 head_s = 0596 head_e = text.find("{ip:'" + ip)597 if head_e - head_s > 20:598 strip_head = text[head_e - 20:head_e]599 tail_s = text.rfind(ip + "',address:'" + address + "'}") + len(ip + "',address:'" + address + "'}")600 tail_e = len(text)601 #print('s=', tail_s, 'e=', tail_e)602 if tail_e - tail_s > 10:603 pos = tail_s + 10604 while pos < (((tail_e - 1) - tail_s) / 2 + tail_s + 1):605 p = text[tail_s + 5:].find(text[tail_s:pos])606 #print('aaaa', p)607 if text[tail_s + 5:].find(text[tail_s:pos]) == -1:608 break609 pos += 1610 tail_e = pos611 strip_tail = text[tail_s:tail_e]612 proxy['strip_head'] = strip_head613 proxy['strip_tail'] = strip_tail614 else:615 return 0616 #print('aaaaaa',proxy.get('delay', 10000))617 if et < proxy.get('delay',10000):618 print(' 更新proxy',proxy['p_type'])619 proxy['delay'] = et620 proxy['method'] = mode621 if mode == 'GET':622 proxy['req']['GET'] = {}623 proxy['req']['GET']['url_encode'] = 'base64' if encode == 1 else None624 proxy['req']['GET']['hl'] = hl625 proxy['p_type'] = 'phproxy_0'626 else:627 proxy['req']['FORM'] = reqdata628 payload = reqdata.get('payload', {})629 #print(text)630 if "ginf={url:" in text:631 proxy['p_type'] = 'Glype'632 if 'ctl00$plhMainBar$txtUrl' == proxy['req']['FORM']['input'] :633 proxy['p_type'] = 'ASPProxy'634 if proxy['p_type'] == 'unknow':635 phproxykeys = """636 hl[strip_title] hl[session_cookies] hl[show_images]637 hl[base64_encode] hl[accept_cookies] hl[show_referer]638 hl[strip_meta] hl[remove_scripts] hl[rotate13] hl[include_form]639 """640 for key in payload.keys():641 if payload[key] in phproxykeys:642 proxy['p_type'] = 'phproxy_0'643 break644 if proxy['p_type'] == 'unknow':645 if reqdata['input'] == 'url':646 proxy['p_type'] = 'php-proxy'647 if proxy['p_type'] == 'unknow':648 proxy['p_type'] = 'ohter'649 proxy['updatetime'] = time.time()650 return 1651 return 0652def parse_ip_address(result):653 s1 = None # 去掉前面的654 s2 = None # 去掉后面的655 if '<!-- Yandex.Metrika counter -->' in ip:656 s2 = '<!-- Yandex.Metrika counter -->'657 if s1 != None:658 ip = ip.split(s1)[1]659 if s2 != None:660 ip = ip[:ip.rfind(s2)]661 # print(ip)662 ip = ip.replace('ip:\'', '"ip":"').replace("',address:'", '","address":"').replace('\'', '"')663 note = None664 if '"}' not in ip:665 ip = ip + '"}'666 note = '原始网页丢失结尾部分字符,可能造成解析错误'667 # print(ip)668def getSSL(ssl):669 return True if ssl == 1 else False670def getform(url,ssl=1):671 url = url.strip()672 print(url)673 req,ssl,well = sniffhost(url)674 if isinstance(req,int):675 return 0676 res = {}677 res['baseurl'] = getbaseurl(url)678 res['p_type'] = 'unknow'679 res['strip_head'] = None680 res['strip_tail'] = None681 res['note'] = []682 res['method'] = 'form'683 res['req'] = {'FORM':{},'GET':{}}684 #res['q'] = 'q'685 if ssl == 0: #正常参数为True,校验ssl,有些网站证书错误,必须关闭这个参数。也可考虑全都关闭686 res['req']['ssl'] = getSSL(ssl) # False687 res['req']['wall'] = well # 是否需要翻墙,为1需要688 if well == 1:print('需要防火墙')689 content = req.content[10:]690 #print(content)691 if b'<form ' in content and b'form>' in content:692 doc = pq(content[content.find(b'<form'):])693 forms = doc('form')694 elif b'<FORM ' in content and b'FORM>' in content:695 # print('aaa')696 doc = pq(content[content.find(b'<FORM'):])697 forms = doc('form')698 else:699 return 0700 #print('aaaa',forms)701 headers = {702 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',703 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6',704 'Accept-Encoding': 'gzip, deflate, sdch',705 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',706 'Upgrade-Insecure-Requests': '1',707 'Cache-Control': 'max-age=0',708 'Connection': 'keep-alive',709 #'Host':'www.ip-adress.com',710 #'Cookie':'flags=3ed',711 'origin':url,712 'Referer':url,713 #':authority':url.replace('http://','').replace('https://',''),714 #':method':'POST',715 #':path':'/index.php',716 #':scheme':'https'717 }718 for form in forms.items():719 formreq = getmethod(form)720 #print(formreq)721 if formreq.get('method',None ) == None:722 continue723 headers['Referer'] = res.get('baseurl')724 ok = 0725 method = formreq.get('method','post').lower()726 submits = formreq.get('submit',{})727 if submits != {}: #多按钮728 print('发现多按钮---------------')729 for key in submits.keys():730 formreq['payload'][key] = submits[key]731 ok += updateproxy(proxy=res, mode='FORM', title='1. default link'732 , ssl=ssl, well=well, reqdata=formreq, encode=0, hl='3ed#')733 if ok > 0:734 break735 else:736 formreq['payload'].pop(key)737 else:738 ok += updateproxy(proxy=res,mode='FORM',title='1. default link'739 ,ssl=ssl,well=well,reqdata=formreq,encode=0,hl='3ed#')740 if res['p_type'] == 'Glype':741 print(res)742 return res743 ok += updateproxy(proxy=res,title='2. get no base64'744 ,ssl=ssl,well=well,reqdata=formreq,encode=0,hl='2c0#')745 ok += updateproxy(proxy=res,title='3. get base64'746 ,ssl=ssl,well=well,reqdata=formreq,encode=1,hl='3ed#')747 if ok > 0:748 print(res)749 return res750def sniffhost(url , headers=None , ssl=None , well=None,count=5):751 def getSSL(ssl):752 return True if ssl == 1 else False753 headers = headers or {754 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',755 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6',756 'Accept-Encoding': 'gzip, deflate, sdch',757 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',758 'Upgrade-Insecure-Requests': '1',759 'Cache-Control': 'max-age=0',760 'Connection': 'keep-alive',761 #'Host':'www.ip-adress.com',762 #'origin':url,763 #'Referer':url764 }765 well = 1766 ssl = 0767 ssl = 1 if ssl == None else ssl768 well = 0 if well == None else well769 req = 0770 try:771 req = requests.get(url,headers=headers , proxies = climb_wall_proxies if well == 1 else {} , verify=getSSL(ssl),timeout=10)772 if req.status_code != 200:773 print('访问错误',req.status_code)774 #print(req.text,ssl,well)775 return req,ssl,well776 except Exception as e:777 if count <=0 :778 return req,ssl,well779 print(e)780 if 'certificate verify failed' in str(e):781 ssl = 0782 if 'No route to host' in str(e) or 'Failed to establish a new connection' in str(e) or 'ConnectionResetError' in str(e):783 well = 1784 return sniffhost(url,headers=headers,ssl=ssl,well=well,count=count-1)785class PHProxy(object):786 def __init__(self):787 pass788 @staticmethod789 def makeproxy(url):790 '''791 从一个url中自动生成一个PHProxy代理对象792 使用getform自动尝试各种可能性,需要正确配置蓝灯,windows下翻墙探测可能不准确793 :param url:794 :return: 代理对象795 '''796 @staticmethod797 def findproxyjson(self,proxy):798 plink = proxy.split('?')[0]799 for p in phproxylist:800 if p['baseurl'] == plink:801 return p802 #new 自动测试803 print('new proxy ',proxy)804 return None805 @staticmethod806 def strip(text,phproxy):807 s1 = phproxy.get('strip_head',None)808 s2 = phproxy.get('strip_tail',None)809 if s1 != None:810 text = text.split(s1)[1]811 if s2 != None:812 text = text[:text.rfind(s2)]813 return text814 @staticmethod815 def _fetch_get(url,phproxy,headers,proxies):816 baseurl = phproxy.get('baseurl')817 q = phproxy.get('q', 'q')818 hl = phproxy.get('hl', '3ed#')819 url_encode = phproxy.get('url_encode', 'base64')820 if url_encode == 'base64':821 url = urllib.parse.quote_from_bytes(base64.b64encode(url.encode('utf8')))822 requrl = r'{}?{}={}&hl={}'.format(baseurl, q, url, hl)823 # print(requrl)824 # requrl = baseurl + '?q=' + 'aHR0cDovL2lwLmNoaW5hei5jb20vZ2V0aXAuYXNweA%3D%3D&hl=3ed#'825 print(requrl)826 sslverify = phproxy.get('ssl',True)827 if proxies != None:828 r = requests.get(requrl, headers=headers, proxies=proxies,verify=sslverify,timeout=10)829 else:830 r = requests.get(requrl, headers=headers,verify=sslverify,timeout=10)831 text = PHProxy.strip(r.text, phproxy)832 return r.status_code, text833 @staticmethod834 def _fetch_post(url,phproxy,headers,proxies):835 baseurl = phproxy.get('baseurl')836 q = phproxy.get('q', 'q')837 payload = {838 q:url,839 'hl[include_form]':'off',840 'hl[remove_scripts]':'off',841 'hl[accept_cookies]':'off',842 'hl[show_images]':'off',843 'hl[show_referer]':'off',844 'hl[rotate13]':'off',845 'hl[base64_encode]':'on',846 'hl[strip_meta]':'off',847 'hl[strip_title]':'off',848 'hl[session_cookies]':'off',849 }850 sslverify = phproxy.get('ssl',True)851 if proxies != None:852 r = requests.post(baseurl, data = payload,headers=headers, proxies=proxies,verify=sslverify,timeout=10)853 else:854 r = requests.post(baseurl, data = payload, headers=headers,verify=sslverify,timeout=10)855 text = PHProxy.strip(r.text, phproxy)856 return r.status_code, text857 @staticmethod858 def fetch(url,phproxy,headers=get_headers(),proxies = None,method=None):859 if isinstance(phproxy,str):860 if '{' in phproxy and '}' in phproxy: #json861 try:862 phproxy = json.loads(phproxy)863 except Exception as e:864 print(e)865 raise ValueError(e)866 else: # 查找json867 phproxy = PHProxy.findproxyjson(phproxy)868 baseurl = phproxy.get('baseurl','http://123.456')869 headers['Referer'] = baseurl870 headers['Host'] = gethost(baseurl)871 headers['Origin'] = getscheme(baseurl) + '://' + headers['Host']872 #if 'www.sslgate.co.uk' in phproxy.get('baseurl'):873 # headers['Host'] = 'letangel.com'874 if proxies == None and phproxy.get('wall') == 1:875 proxies = climb_wall_proxies876 if method == None:877 method = phproxy.get('method','GET')878 try:879 if method == 'GET':880 return PHProxy._fetch_get(url,phproxy,headers,proxies)881 elif method == 'POST':882 return PHProxy._fetch_post(url,phproxy,headers,proxies)883 else:884 raise ValueError('错误模式')885 except Exception as e:886 print(e)887 return 0,'无内容'888 @staticmethod889 def testproxylist(plist=phproxylist,needtest=1):890 ipset = set()891 print('列表长度={}'.format(len(plist)))892 def getstr(s, begin, end):893 pos = s.find('being') + len(begin)894 posend = s[pos:].find(end)895 return s[pos:posend]896 for p in plist:897 if p.get('needtest', 0) == needtest:898 code = 0899 content = '无内容'900 if p.get('needtest', 0) != 3:901 try:902 chekip = 'http://ip.chinaz.com/getip.aspx'903 t = time.time()904 code, content = PHProxy.fetch(chekip, p, method='GET')905 t1 = time.time()906 code2, content2 = PHProxy.fetch(chekip, p, method='POST')907 t2 = time.time()908 except Exception as e:909 print(e)910 finally:911 print(p)912 if isinstance(content, bytes):913 print(t1 - t, code, content.decode('utf8'))914 else:915 print(t1 - t, code, content)916 if isinstance(content2, bytes):917 print(t2 - t1, code2, content2.decode('utf8'))918 else:919 print(t2 - t1, code2, content2)920 ip1 = getstr(content, "{ip:'", "'address")921 ip2 = getstr(content2, "{ip:'", "'address")922 ip3 = p.get('ip')923 if ip1 in ipset or ip2 in ipset or ip3 in ipset:924 print('ip重复', p)925 if len(ip1) > 7:926 ipset.add(ip1)927 if len(ip1) > 7:928 ipset.add(ip2)929 if len(ip1) > 7:930 ipset.add(ip3)931def test():932 global t_count933 while True:934 lock_read.acquire()935 t_count += 1936 print('读文件', t_count)937 line = inFile.readline().strip()938 lock_read.release()939 if len(line) == 0: break940 url = line.split(' ')[0].strip()941 host = gethost(line)942 if url[0] != 'h':943 continue944 baseurl = ''945 if len(url) > 5:946 baseurl = getbaseurl(url)947 if len(baseurl) < 5:948 continue949 try:950 ip = getIp(host)951 print('-----------------------------------------------------------------')952 print(line, ip)953 proxy = getform(baseurl)954 if proxy.get('p_type', 'unknow') != 'unknow':955 s = proxy.get('baseurl') + ' |' + str(proxy.get('mutil_ip')) + ' |' + str(proxy) + '\n'956 lock_write.acquire()957 print(s)958 with open('phproxy-list-2017-7-13.txt', 'a', encoding='utf8') as outFile:959 outFile.write(s)960 lock_write.release()961 except Exception as e:962 print('error', baseurl)963 print(e)964 continue965if __name__ == "__main__":966 import threading967 inFile = open('crawl_listproxysites_com.txt', 'r',encoding='utf8')968 lock_read = threading.Lock()969 lock_write = threading.Lock()970 t_count = 0971 all_thread = []972 for i in range(50):973 t = threading.Thread(target=test)974 all_thread.append(t)975 t.start()976 for t in all_thread:977 t.join()978 inFile.close()979 exit()980 #'http://phx.unblock-me.org/direct/aHR0cHM6Ly93d3cuamQuY29tLw-- ' #正确的地址,如何去掉尾部?981 # http://zigproxy.com/ 尾部丢失1个字节,可修复982 # http://www.imzi-tours-travel.com/annuaire/983 #https://www.ninjaproxy.ninja/browse.php/WwDRC_2Bp8ZB26yvBWOlc_3D/b29/fnorefer/984 #getform('http://uberstudyguide.com')985 #getform('http://62.109.25.136/index.php')986 #getform('http://proxy.proxysite.win/') #very fast glype987 #getform('https://www.best-proxy.com.de/index.php') # phproxy #ssl 错误 页面容易解析错988 #getform('http://itwtf.com/index.php') #php-proxy 引擎989 #getform('http://proxy.tian-le.net/phpproxy.php') #疑似php-proxy990 #getform('http://anonymizer.in/anonymizer/')991 #getform('http://anonymouse.org/anonwww_de.html') #特殊类型992 #getform('http://hidebox.ru/index.php')993 #getform('http://qc.stop-block.com/direct/aHR0cHM6Ly93d3cuamQuY29tLw--')994 #getform('https://viewpro.info/')995 #getform('http://superproxy.top/index.php')996 #getform('http://anonymousonline.gq/')997 #getform('http://zigproxy.com/')998 #getform('http://gvirabi.com/')999 #http://www.radiocarb.com/p/index.php51000 #http://proxyanonymity.gq/1001 #http://lackmoney.cf/1002 #http://home.iitk.ac.in/~ravikira/glype-1.4.10/index.php1003 # http://instantunblock.com/facebook-proxy/1004 #http://www.samstevenm.net/prox/index.php1005 #getform('http://morestep.ml')1006 #http://www.exiost.com/1007 #http://checkday.gq1008 #http://gamemarket.ml/1009 #http://learnfirst.ga1010 #exit(0)1011 plist = [ {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q', 'address': '北京联通',1012 'baseurl': 'http://fantaluciano.altervista.org/poste/index.php', 'hl': '3ed', 'url_encode': 'base64', 'note': None,1013 'method': 'POST',1014 'ip': '114.241.70.59', 'wall': 1, 'needtest': 0,'block':1},1015 {'strip_tail': None, 'strip_head': None, 'p_type': 'phproxy_0', 'q': 'q',1016 'address': '美国 犹他州盐湖城Bluehost公司',1017 'baseurl': 'http://www.dmburke.com/PHPProcksy/index.php', 'hl': '3ed', 'url_encode': 'base64',1018 'note': '',1019 'method': 'POST',1020 'ip': '173.254.28.144', 'wall': 0, 'needtest': 1, 'block': 0,},1021 ]1022 print(gethost('http://fantaluciano.altervista.org/poste/index.php'))1023 print(getscheme('http://fantaluciano.altervista.org/poste/index.php'))1024 print(getpath('http://fantaluciano.altervista.org/poste/index.php'))1025 #PHProxy.testproxylist(plist,needtest=1)1026 lines = []1027 with open('crawl_listproxysites_com.txt','r',encoding='utf8') as f:1028 lines = f.readlines()1029 proxyhosts = []1030 i=01031 for p in phproxylist:1032 proxyhosts.append(gethost(p.get('baseurl')))1033 def geturlbyhost(host):1034 for pp in phproxylist:1035 baseurl = pp.get('baseurl')1036 if gethost(baseurl) == host:1037 return baseurl1038 for line in lines:1039 line = line[:-1]1040 url = line.split(' ')[0]1041 host = gethost(line)1042 if host in proxyhosts:1043 print('已在列表存在|',line,geturlbyhost(host))1044 #continue1045 #print(line)1046 baseurl = ''1047 if len(url) > 5:1048 baseurl = url.split('?')[0]1049 if url[0] != 'h':1050 continue1051 if len(baseurl) < 5:1052 continue1053 domain = gethost(baseurl)1054 try:1055 ip = getIp(domain)1056 print('-----------------------------------------------------------------')1057 print(line, ip)1058 proxy = getform(baseurl)1059 if proxy.get('p_type','unknow') != 'unknow':1060 with open('phproxy-list-2017-7-12-crawl_listproxysites_com.txt','a',encoding='utf8') as f:1061 s = proxy.get('baseurl') + ' |' + str(proxy.get('mutil_ip')) + ' |' + str(proxy) + '\n'1062 f.write(s)1063 # get_ip_info(ip)1064 except Exception as e:1065 print('error', baseurl)1066 print(e)1067 continue1068 continue1069 if i>2:1070 break...

Full Screen

Full Screen

saml.py

Source:saml.py Github

copy

Full Screen

...34 if assertion:35 if _is_decoded(assertion) and base64_encode:36 assertion = core_utils.encode_base64(assertion, url_encode_object=url_encode)37 elif not _is_decoded(assertion) and '=' in assertion and url_encode:38 assertion = core_utils.url_encode(assertion)39 else:40 assertion = import_assertion(file_path, base64_encode, url_encode)41 uri = _get_api_uri(khoros_object)42 response = api.post_request_with_retries(uri, url_encoded_payload=assertion, return_json=False,43 khoros_object=khoros_object)44 return response45def import_assertion(file_path, base64_encode=True, url_encode=True):46 """This function imports an XML SAML assertion as a string and optionally base64- and/or URL-encodes it.47 .. versionadded:: 4.3.048 :param file_path: The file path to the XML file to import49 :type file_path: str50 :param base64_encode: Determines if the assertion should be base64-encoded (``True`` by default)51 :type base64_encode: bool52 :param url_encode: Determines if the assertion should be URL-encoded (``True`` by default)53 :type url_encode: bool54 :returns: The SAML assertion string55 :raises: :py:exc:`FileNotFoundError`56 """57 with open(file_path, 'r') as file:58 assertion = file.read()59 if base64_encode:60 assertion = core_utils.encode_base64(assertion)61 if url_encode:62 assertion = core_utils.url_encode(assertion)63 return assertion64def _is_decoded(_assertion):65 """This function checks to see if a SAML assertion is base64- or url-encoded.66 .. versionadded:: 4.3.067 :param _assertion: The SAML assertion string to be examined68 :type _assertion: str69 :returns: Boolean value indicating whether or not the SAML assertion string is encoded70 :raises: :py:exc:`TypeError`71 """72 return True if '<saml' in _assertion else False73def _get_api_uri(_khoros_object):74 """This function retrieves the API URI to call in the POST request.75 .. versionadded:: 4.3.076 :param _khoros_object: The core :py:class:`khoros.Khoros` object...

Full Screen

Full Screen

api.py

Source:api.py Github

copy

Full Screen

2import requests3API_ENDPOINT = "HTTPS://FLY-SUJAL.HEROKUAPP.COM/?oci={}&oco={}&dci={}&dco={}&dd={}"4def __generate_query_url(oci, oco, dci, dco, dd):5 return API_ENDPOINT.format(6 url_encode(oci),7 url_encode(oco),8 url_encode(dci),9 url_encode(dco),10 url_encode(dd)11 )12def __fetch_query(oci, oco, dci, dco, dd):13 url = __generate_query_url(oci, oco, dci, dco, dd)14 print(url)15 return requests.get(url).content.decode()16def get_tickets(oci, oco, dci, dco, dd):17 response = eval(__fetch_query(oci, oco, dci, dco, dd))18 if response["status"] == "success":19 tickets = response["tickets"]20 return tickets21 else:22 print("Server Error!")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run hypothesis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful