From 88a19416bcfbbd625db04b381adf2b7a00e0b704 Mon Sep 17 00:00:00 2001 From: "xianping.wen" <931128603@qq.com> Date: Wed, 18 Dec 2019 16:25:20 +0800 Subject: [PATCH] add open str --- UnitTest/TestAll.py | 20 +- filter_cdn_list | 747 ++++++++++++++++++------------------- init/select_ticket_info.py | 27 +- 3 files changed, 396 insertions(+), 398 deletions(-) diff --git a/UnitTest/TestAll.py b/UnitTest/TestAll.py index f69124a..b73091a 100644 --- a/UnitTest/TestAll.py +++ b/UnitTest/TestAll.py @@ -6,11 +6,11 @@ from collections import OrderedDict import requests +import TickerConfig from agency.agency_tools import proxy -from agency.cdn_utils import CDNProxy from config.emailConf import sendEmail from config.serverchanConf import sendServerChan -from init.select_ticket_info import select +from inter.LiftTicketInit import liftTicketInit def _set_header_default(): @@ -25,7 +25,6 @@ def _set_header_default(): class testAll(unittest.TestCase): - def testProxy(self): """ 测试代理是否可用 @@ -105,14 +104,15 @@ class testAll(unittest.TestCase): 测试cdn筛选 :return: """ - CDN = CDNProxy() - all_cdn = CDN.open_cdn_file() + cdn = ["60.9.0.19", "60.9.0.20", "113.16.212.251", "36.250.248.27"] + from inter.LiftTicketInit import liftTicketInit + from init.select_ticket_info import select + from config.getCookie import getDrvicesID + s = select() - all_cdn = self.open_cdn_file() - cdns = [all_cdn[i:i + 50] for i in range(0, len(all_cdn), 50)] - for i in cdns: - t = threading.Thread(target=s.cdn_req, args=(i,)) - t.start() + s.httpClint.cdn = cdn[3] + getDrvicesID(s) + liftTicketInit(s).reqLiftTicketInit() if __name__ == '__main__': diff --git a/filter_cdn_list b/filter_cdn_list index d0bfdb2..5deddfa 100644 --- a/filter_cdn_list +++ b/filter_cdn_list @@ -1,564 +1,559 @@ 111.161.122.240 -58.221.78.231 -222.186.141.146 +112.90.135.96 60.9.0.19 +61.162.100.102 +222.186.141.146 +221.235.187.129 +58.221.78.231 113.16.212.251 -116.77.75.133 +112.47.27.131 112.123.33.18 -221.235.187.129 183.134.42.18 -112.90.135.96 -112.47.27.131 +116.77.75.133 +112.90.135.97 58.221.78.42 -61.162.100.102 +61.162.100.103 111.161.122.67 -113.16.212.48 60.9.0.20 -116.77.75.137 -112.90.135.97 -221.235.187.130 +113.16.212.48 +112.47.56.174 112.28.196.75 183.134.42.19 -112.47.56.174 -116.199.127.56 +116.77.75.137 112.90.135.98 -61.162.100.103 -60.9.0.21 113.16.212.49 -36.102.230.136 -183.134.42.190 -112.90.135.99 +36.250.248.220 +60.9.0.21 +116.199.127.56 +221.235.187.130 112.47.27.172 -116.77.75.138 +112.90.135.99 +183.134.42.190 60.9.0.22 -36.250.248.220 -36.102.230.137 +222.186.141.165 +116.77.75.138 +36.102.230.136 +112.47.56.117 183.134.42.191 -116.77.75.145 60.9.0.23 -112.47.56.117 -222.186.141.165 +116.77.75.145 +36.102.230.137 +222.186.141.166 +58.221.78.46 +61.162.100.107 116.77.75.144 -183.134.42.20 +113.207.77.252 60.9.0.252 -58.221.78.46 +222.186.141.178 +183.134.42.20 +61.167.54.55 +58.221.78.47 +221.180.208.54 116.77.75.169 -222.186.141.166 +61.162.100.252 +222.186.141.186 60.9.0.254 +113.207.79.17 183.134.42.247 -221.180.208.54 +61.167.54.57 +111.161.22.17 116.77.75.146 -58.221.78.47 -61.162.100.107 -222.186.141.178 -111.6.176.208 58.221.78.48 +61.162.100.41 +111.6.176.208 +113.207.79.34 +36.250.248.222 +36.102.230.19 183.134.53.153 116.77.75.147 -61.162.100.252 -61.167.54.55 -222.186.141.186 +61.162.100.44 111.6.176.209 +113.207.79.42 183.134.53.155 -36.102.230.19 116.77.75.170 -111.161.22.17 -61.162.100.41 -61.167.54.57 -111.6.176.248 36.102.230.20 -61.162.100.44 -111.6.176.25 -36.250.248.222 -111.6.176.94 -111.6.176.95 -113.207.77.252 -111.6.176.97 -113.207.79.17 -113.207.79.34 -222.218.87.252 -113.207.79.42 120.221.64.161 +222.218.87.252 +111.6.176.248 113.207.79.37 -221.235.187.220 120.221.64.169 -36.250.248.252 112.47.56.118 -113.207.81.126 -221.235.187.244 -36.250.248.254 -183.134.53.223 -36.250.248.27 -116.77.75.183 -120.221.64.53 -221.235.187.66 -120.221.64.54 -183.134.53.248 -221.235.187.90 -120.221.64.55 -183.146.22.135 -221.235.187.98 +111.6.176.25 113.194.59.80 124.236.28.100 -183.146.22.136 -113.207.81.78 +113.207.81.126 +111.6.176.94 +111.6.176.95 113.194.59.199 -183.146.22.137 -113.207.81.81 -113.194.59.81 -123.128.14.254 +221.235.187.220 124.236.28.252 -123.128.14.69 -36.102.230.254 +221.235.187.244 +111.6.176.97 124.236.28.67 +113.194.59.81 +120.221.64.53 +36.250.248.252 +120.221.64.54 124.236.28.247 +36.250.248.254 +120.221.64.55 124.236.28.69 -36.250.248.56 +116.77.75.183 +36.250.248.27 +221.235.187.66 +183.134.53.223 124.236.28.68 -111.161.22.62 -125.39.1.134 -125.39.1.191 -27.195.145.121 +113.207.81.78 58.20.179.253 -42.81.144.179 -124.236.28.93 +27.195.145.121 +221.235.187.90 +113.207.81.81 27.195.145.123 -42.81.144.180 -124.236.28.92 +221.235.187.98 +123.128.14.254 +183.134.53.248 +111.161.22.62 +123.128.14.69 +124.236.28.93 117.169.93.249 +183.146.22.135 +125.39.1.134 +36.102.230.254 +124.236.28.92 +117.169.93.85 +27.195.145.249 +125.39.1.191 124.236.28.94 +42.81.144.179 222.218.87.28 -117.169.93.85 +27.195.145.52 124.236.28.95 -117.149.154.185 +36.250.248.56 222.218.87.29 -117.149.154.186 -27.195.145.249 +42.81.144.180 +27.195.145.62 36.159.115.250 -27.195.145.52 36.159.115.88 -27.195.145.62 36.159.115.89 +183.146.22.137 110.242.21.24 +124.236.28.98 +117.169.93.86 123.128.14.70 110.242.21.23 +124.236.28.99 +117.23.2.252 123.128.14.72 +112.28.196.54 110.242.21.254 +117.149.154.185 +58.20.179.74 150.138.111.251 -150.138.111.31 -124.236.28.98 +117.23.2.28 110.242.21.243 +117.149.154.186 +58.20.179.73 +150.138.111.31 110.242.21.41 +117.23.2.29 +111.47.220.251 150.138.111.32 -124.236.28.99 -150.138.111.33 110.242.21.71 -150.138.167.234 +106.41.0.37 +111.47.220.66 110.242.21.70 -183.146.22.145 +150.138.111.33 +111.47.220.67 +106.41.0.44 +150.138.167.234 150.138.167.50 -183.146.22.146 -117.149.154.250 +106.41.0.45 +222.186.145.51 150.138.167.52 -150.138.169.120 -117.169.93.86 -150.138.169.121 -112.28.196.54 111.62.194.30 -150.138.169.123 -111.62.194.31 -150.138.169.124 -117.149.155.148 -111.62.194.254 -117.149.155.147 -59.56.30.51 -111.47.220.251 -111.47.220.66 -111.47.220.67 -117.23.2.252 -117.149.155.76 -42.81.144.31 -58.20.179.74 -117.23.2.28 -122.224.186.221 -42.81.144.39 -117.23.2.29 -183.146.22.171 -122.224.186.222 -222.186.145.51 -122.224.186.225 +106.41.0.46 122.228.237.248 -120.253.100.20 +42.81.144.31 +150.138.169.120 222.186.145.54 -122.224.186.226 -58.20.179.73 -112.28.196.251 -120.253.100.21 +59.56.30.51 +106.41.0.47 +42.81.144.39 +111.62.194.31 222.44.151.24 -106.41.0.37 +150.138.169.121 +112.28.196.251 +106.41.0.61 +111.62.194.254 +123.138.157.85 +106.120.178.19 150.138.167.51 -120.253.100.22 +150.138.169.123 112.28.196.249 -106.41.0.44 -120.253.100.23 -112.28.196.53 -123.138.157.85 -106.41.0.45 -122.224.186.253 -112.28.196.74 -120.253.100.30 -150.138.169.238 -123.138.157.122 -106.41.0.46 -222.186.145.52 -106.41.0.47 -106.41.0.61 106.41.0.62 -106.120.178.19 -150.138.214.84 +120.253.100.20 +114.112.172.58 +123.138.157.122 +150.138.169.124 +183.146.22.145 +112.28.196.53 +120.253.100.21 222.44.151.191 -115.157.63.19 +183.146.22.146 125.77.147.254 -60.210.23.26 +112.28.196.74 +120.253.100.22 222.44.151.25 -150.138.214.124 -60.28.100.155 +222.186.145.52 +120.253.100.23 61.151.238.197 -221.235.187.119 -150.138.214.85 -122.225.83.25 +120.253.100.30 61.151.238.222 -150.138.214.86 -60.28.100.156 61.151.238.229 -122.225.83.28 -115.157.63.49 -60.28.100.157 -122.228.237.74 -115.157.63.50 -60.28.100.158 -122.228.237.75 -115.157.63.51 -60.28.100.248 -115.157.63.52 -122.228.237.76 -117.180.229.254 -115.157.63.62 -122.228.239.233 -117.180.229.142 -122.228.239.234 -122.228.239.235 -122.228.239.236 -183.201.225.249 -183.201.225.74 -122.228.239.238 -116.207.132.183 -183.201.225.73 +117.149.155.148 +117.149.155.147 +183.146.22.171 +150.138.169.238 +60.210.23.26 125.77.147.68 -122.228.239.243 -116.207.132.184 -218.26.75.149 +221.235.187.119 125.77.147.69 -122.228.239.244 -116.207.132.253 -60.210.23.116 -218.26.75.150 -122.228.239.246 -61.147.226.46 -218.26.75.151 -36.25.241.75 -222.186.145.53 +115.157.63.19 +117.149.155.76 +115.157.63.49 +122.224.186.221 +183.201.225.249 119.52.120.138 -218.26.75.152 -36.25.241.76 -61.147.226.48 -183.66.109.254 +60.28.100.155 125.77.147.80 -58.216.21.250 -36.25.241.77 -218.26.75.153 -122.224.186.223 +122.70.142.148 +122.224.186.222 119.52.120.139 +60.28.100.156 +122.70.142.147 125.77.147.82 -60.210.23.29 -218.26.75.206 +122.224.186.225 +60.28.100.157 119.52.120.140 125.77.147.88 -218.26.75.236 +114.112.172.57 +122.224.186.226 +60.28.100.158 +150.138.214.84 119.52.120.144 -183.66.109.44 +58.216.21.250 +60.28.100.248 119.52.120.145 +150.138.214.124 +60.210.23.116 +183.66.109.254 +117.180.229.254 +150.138.214.85 +119.52.120.146 +61.147.226.46 +115.157.63.50 +122.224.186.253 58.216.22.17 +150.138.214.86 +222.186.145.53 +117.180.229.142 58.216.22.20 -119.52.120.146 -183.66.109.45 +183.222.97.164 +61.147.226.48 58.216.22.22 +183.222.97.165 +122.224.186.223 +183.66.109.44 58.216.22.56 -121.22.247.202 -121.22.247.204 -121.22.247.254 -112.240.60.213 -112.240.60.214 -122.70.142.148 -113.207.10.204 -112.240.60.215 -122.70.142.147 -112.240.60.216 -113.207.10.218 -112.240.60.217 -112.240.60.222 -112.240.60.236 +183.222.97.166 +60.210.23.29 +221.235.187.67 +183.66.109.45 +115.157.63.51 +183.222.97.254 183.146.22.142 -120.226.55.144 -183.222.97.164 183.146.22.139 -183.222.97.165 -120.226.55.151 +120.226.55.144 221.235.187.121 +153.99.235.112 +120.226.55.151 120.226.55.254 -183.222.97.166 -183.222.97.254 +112.240.60.213 +36.25.241.75 +122.225.83.25 +153.99.235.91 +112.240.60.214 +122.225.83.28 +115.157.63.52 +36.25.241.76 +121.22.247.202 +114.112.172.59 +122.228.237.74 +36.25.241.77 +112.240.60.215 +121.22.247.204 223.111.18.161 +122.228.237.75 +112.240.60.216 +121.22.247.254 +218.26.75.149 223.111.18.162 +122.228.237.76 +112.240.60.217 +115.157.63.62 +218.26.75.150 223.111.18.163 -153.99.235.112 -223.111.18.217 122.225.83.26 +122.228.239.233 +112.240.60.222 +223.111.18.217 +218.26.75.151 222.186.145.251 +122.228.239.234 +112.240.60.236 +218.26.75.152 +116.207.132.183 +122.228.239.235 61.147.227.53 -153.99.235.91 -121.22.247.203 -60.220.196.220 -60.220.196.221 -125.74.58.134 -123.53.139.253 +159.226.225.149 +218.26.75.153 +116.207.132.184 +122.228.239.236 +116.207.132.253 +218.26.75.206 +113.207.10.204 +122.228.239.238 +218.26.75.236 +113.207.10.218 +122.228.239.243 +122.228.239.244 +122.228.239.246 139.209.49.140 -125.74.58.135 -123.53.139.36 +183.131.124.38 +159.226.225.154 139.209.49.138 -14.204.185.100 -125.74.58.136 +121.22.247.203 139.209.49.144 -14.204.185.101 +123.53.139.253 139.209.49.151 -14.204.185.102 +125.74.58.134 139.209.49.152 -14.204.185.123 -139.209.49.153 -14.204.185.254 -113.207.70.194 -113.207.70.207 -183.131.124.38 -125.74.58.254 -113.207.70.208 -60.220.196.250 -210.38.3.23 -210.38.3.24 -210.38.3.42 -210.38.3.49 +123.53.139.36 +125.74.58.135 +125.74.58.136 +139.209.49.153 123.184.108.251 -210.38.3.50 -159.226.225.149 +210.38.3.23 183.131.124.40 123.184.108.60 -210.38.3.60 -14.204.185.91 123.184.108.61 -113.207.72.102 +210.38.3.24 +159.226.225.139 183.131.124.58 -113.207.70.209 -183.131.124.59 -113.207.77.117 +125.74.58.254 +210.38.3.42 +159.226.225.140 +61.54.7.158 124.95.148.254 -223.111.198.252 +183.131.124.59 +61.54.7.174 +210.38.3.49 124.95.148.30 -59.83.232.18 -223.111.198.65 +101.69.146.234 +210.38.3.50 +61.54.7.179 124.95.148.29 -59.83.232.50 +14.204.185.100 +210.38.3.60 +61.54.7.243 +60.220.196.220 124.95.148.31 +14.204.185.101 +60.220.196.221 +59.83.232.18 +14.204.185.102 +59.83.232.50 61.147.210.193 +122.70.142.252 +14.204.185.123 61.147.210.195 +14.204.185.254 +223.111.198.252 61.147.226.185 -61.54.7.158 -101.69.146.234 +101.69.146.33 +223.111.198.65 +113.207.70.194 61.147.210.242 -61.54.7.174 -159.226.225.154 +113.207.70.207 +101.69.146.35 +60.210.23.23 61.147.226.47 -61.54.7.179 +113.207.70.208 +101.69.146.34 +60.210.23.25 61.147.226.49 -61.54.7.243 +183.131.168.148 +60.210.23.27 61.147.227.102 -61.147.227.126 -60.210.23.23 -101.69.146.33 -60.210.23.25 -101.69.146.35 -101.69.146.34 +113.207.72.102 +60.213.21.117 58.220.71.253 -60.210.23.27 +61.147.227.126 58.220.71.51 -60.213.21.117 -58.220.71.52 -58.220.71.62 60.213.21.118 -183.131.168.148 -58.220.71.63 -159.226.225.139 +14.204.185.91 +58.220.71.52 +113.207.70.209 60.213.21.156 +113.207.77.117 +60.213.21.214 +60.220.196.250 +58.220.71.62 116.199.127.50 -159.226.225.140 +60.213.21.244 +58.220.71.63 +118.123.233.254 116.199.127.54 -116.77.73.164 218.29.198.43 -218.29.198.62 58.220.71.64 -116.199.127.55 -58.220.71.65 -60.213.21.214 -60.213.21.244 60.213.21.243 -60.213.21.245 -103.254.189.230 -60.213.21.252 -122.70.142.252 -118.123.233.254 118.123.233.30 -61.147.228.201 +218.29.198.62 +116.77.73.164 +103.254.189.230 +58.220.71.65 +60.213.21.245 118.123.233.31 -61.147.228.60 -183.214.132.120 -183.214.132.16 -183.214.132.17 -112.90.135.229 223.86.219.254 -36.250.233.185 +183.214.132.120 +60.213.21.252 223.86.219.65 -36.250.233.208 -36.250.233.209 +183.214.132.16 +116.199.127.55 223.86.219.66 -36.250.233.210 +183.214.132.17 60.255.143.93 +61.149.9.150 60.255.143.94 -106.40.140.224 -106.40.140.222 60.255.143.95 -123.128.14.71 60.255.143.96 -222.24.122.79 +36.250.233.185 +106.40.140.224 +36.250.233.208 +61.147.228.201 +36.250.233.209 +183.214.140.204 123.53.139.37 -183.214.140.203 222.24.122.86 -183.214.140.204 -58.221.78.186 -222.24.122.89 +61.147.228.60 +36.250.233.210 +106.40.140.254 +183.214.140.238 36.250.233.214 36.250.233.228 +58.221.78.186 36.250.248.218 +218.12.228.246 +112.90.135.244 +222.24.122.89 36.250.248.217 +221.235.187.106 +218.12.228.38 36.250.233.254 -112.90.135.244 -183.214.140.238 +112.47.20.250 +218.12.228.39 112.90.135.92 -106.40.140.254 -112.90.135.93 -112.90.135.94 -221.235.187.106 -112.90.135.95 -61.149.9.150 -218.60.185.251 117.27.245.227 -218.12.228.246 -218.60.185.46 +112.90.135.93 117.27.245.254 -218.12.228.38 117.27.245.52 -218.60.185.47 -218.12.228.39 +112.90.135.94 117.27.245.97 -218.60.185.48 -61.147.228.89 +112.90.135.95 117.27.245.54 -221.180.192.100 +218.60.185.251 +113.5.80.33 125.77.130.247 +218.60.185.46 125.77.130.251 -125.77.130.46 -125.77.130.47 -125.77.130.48 -112.47.20.250 -125.77.130.49 -163.177.132.27 -219.138.27.108 -219.138.27.249 -113.5.80.33 -221.180.192.254 118.203.202.206 118.203.202.207 -219.138.27.30 +218.60.185.47 +218.60.185.48 118.203.202.208 -219.138.27.31 118.203.202.209 118.203.202.222 -221.180.192.61 -106.120.178.253 +221.180.192.100 +125.77.130.46 +125.77.130.47 112.47.20.68 +125.77.130.48 +163.177.132.27 112.47.27.132 +125.77.130.49 112.47.20.89 +61.147.228.89 +112.47.20.79 +106.120.178.253 +221.180.192.254 +221.230.141.170 +221.180.192.61 +106.120.178.20 +163.177.132.30 +183.216.176.74 +221.230.141.172 +183.216.176.75 +221.230.141.174 110.19.204.219 110.19.204.220 -112.47.20.79 -113.142.80.223 +219.138.27.108 110.19.204.221 -113.16.208.251 -163.177.132.30 -113.16.208.77 -106.120.178.20 -113.16.208.78 -221.230.141.170 -113.142.80.69 -110.19.204.254 -113.142.80.71 -117.161.19.126 -113.142.80.72 -221.180.208.252 -117.161.19.19 -117.161.19.22 +219.138.27.249 103.254.189.229 -221.180.208.46 106.120.178.22 -221.180.208.47 -221.230.141.172 -221.230.141.174 -183.216.176.74 -183.216.176.75 +219.138.27.30 +219.138.27.31 +113.16.208.251 222.186.141.132 -60.9.0.18 +113.16.208.77 +113.16.208.78 222.186.141.141 +110.19.204.254 222.186.141.142 +221.180.208.252 222.186.141.143 +117.161.19.126 +221.180.208.46 222.186.141.145 +60.9.0.18 +117.161.19.19 +221.180.208.47 +117.161.19.22 +113.142.80.223 183.134.42.153 -115.223.24.254 183.134.42.154 183.134.42.155 +115.223.24.254 183.134.42.156 +111.161.122.100 183.134.42.157 -183.134.42.158 61.136.167.17 -183.134.42.159 +183.134.42.158 61.136.167.18 +183.134.42.159 +113.142.80.69 183.134.42.17 -222.74.113.196 -222.74.113.219 +113.142.80.71 61.136.167.19 -111.161.122.100 +113.142.80.72 115.223.24.80 -115.223.24.81 -115.223.24.82 -114.112.172.56 111.161.122.133 +115.223.24.81 111.161.122.134 +115.223.24.82 111.161.122.135 +114.112.172.56 +222.74.113.196 +222.74.113.219 61.167.54.236 61.167.54.242 diff --git a/init/select_ticket_info.py b/init/select_ticket_info.py index 86bd24a..7203aa6 100755 --- a/init/select_ticket_info.py +++ b/init/select_ticket_info.py @@ -130,23 +130,26 @@ class select: s = getPassengerDTOs(selectObj=self, ticket_peoples=TickerConfig.TICKET_PEOPLES) passenger = s.sendGetPassengerDTOs() wrapcache.set("user_info", passenger, timeout=9999999) + + now = datetime.datetime.now() + if TickerConfig.ORDER_MODEL is 1: + print(f"预售还未开始,阻塞中,预售时间为{TickerConfig.OPEN_TIME}, 当前时间为: {now.strftime('%H:%M:%S')}") + sleep_time_s = 0.5 + sleep_time_t = 0.6 + # 测试了一下有微妙级的误差,应该不影响,测试结果:2019-01-02 22:30:00.004555,预售还是会受到前一次刷新的时间影响,暂时没想到好的解决方案 + while now.strftime("%H:%M:%S") < TickerConfig.OPEN_TIME: + now = datetime.datetime.now() + time.sleep(0.0001) + print(f"预售开始,开启时间为: {now.strftime('%H:%M:%S')}") + else: + sleep_time_s = TickerConfig.MIN_TIME + sleep_time_t = TickerConfig.MAX_TIME + while 1: try: num += 1 now = datetime.datetime.now() # 感谢群里大佬提供整点代码 configCommon.checkSleepTime(self) # 晚上到点休眠 - if TickerConfig.ORDER_MODEL is 1: - sleep_time_s = 0.5 - sleep_time_t = 0.6 - # 测试了一下有微妙级的误差,应该不影响,测试结果:2019-01-02 22:30:00.004555,预售还是会受到前一次刷新的时间影响,暂时没想到好的解决方案 - while not now.strftime("%H:%M:%S") == TickerConfig.OPEN_TIME: - now = datetime.datetime.now() - if now.strftime("%H:%M:%S") > TickerConfig.OPEN_TIME: - break - time.sleep(0.0001) - else: - sleep_time_s = TickerConfig.MIN_TIME - sleep_time_t = TickerConfig.MAX_TIME q = query(selectObj=self, from_station=from_station, to_station=to_station,