{"id":4807,"date":"2024-09-09T10:14:52","date_gmt":"2024-09-09T02:14:52","guid":{"rendered":"http:\/\/cnliutz.ipyingshe.net\/?p=4807"},"modified":"2024-09-09T10:14:54","modified_gmt":"2024-09-09T02:14:54","slug":"python%e7%9a%84proxybroker%e5%ba%93%e6%9f%a5%e6%89%be%e4%bb%a3%e7%90%86%e8%b5%84%e6%ba%90","status":"publish","type":"post","link":"http:\/\/xc.ipyingshe.net:5347\/?p=4807","title":{"rendered":"python\u7684proxybroker\u5e93\u67e5\u627e\u4ee3\u7406\u8d44\u6e90"},"content":{"rendered":"\n<p class=\"has-text-align-left has-blue-color has-text-color has-link-color wp-elements-e9a2ab70d09586a849534766ed9c5bdc\"><strong>\u6ce8\u610f\u6b64\u5e93\u4f7f\u7528python3.7\u7248\uff0c\u907f\u5751\uff0c\u5426\u5219\u8fd0\u884c\u65f6\u51fa\u9519\uff01\uff01\uff01<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528 Python \u7684`proxybroker`\u5e93\u7ed3\u5408`tkinter`\u521b\u5efa\u7b80\u5355\u56fe\u5f62\u754c\u9762\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\n# \u8fd9\u4e2a\u754c\u9762\u53ef\u4ee5\u663e\u793a\u627e\u5230\u7684\u4ee3\u7406\u4fe1\u606f\u5e76\u63d0\u4f9b\u4e00\u4e2a\u6309\u94ae\u6765\u67e5\u627e\u65b0\u7684\u4ee3\u7406\uff1a\n# \u8fd9\u4e2a\u793a\u4f8b\u4ee3\u7801\u521b\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u56fe\u5f62\u754c\u9762\uff0c\n    # \u5176\u4e2d\u5305\u542b\u4e00\u4e2a\u6587\u672c\u6846\u7528\u4e8e\u663e\u793a\u627e\u5230\u7684\u4ee3\u7406\u4fe1\u606f\uff0c\n    # \u4ee5\u53ca\u4e00\u4e2a\u6309\u94ae\u7528\u4e8e\u89e6\u53d1\u4ee3\u7406\u67e5\u627e\u64cd\u4f5c\u3002\n# python\nimport asyncio\nimport tkinter as tk\nfrom proxybroker import Broker\n\ndef display_proxies(proxies):\n    for proxy in proxies:\n        proxy_info = f'{proxy.type}:\/\/{proxy.host}:{proxy.port}'\n        proxy_text.insert(tk.END, proxy_info + '\\n')\n\nasync def find_proxies():\n    proxies = &#91;]\n    broker = Broker()\n    found_proxies = await broker.find(types=&#91;'HTTP', 'HTTPS'], limit=10)\n    for proxy in found_proxies:\n        proxies.append(proxy)\n    display_proxies(proxies)\n\ndef on_find_clicked():\n    asyncio.run(find_proxies())\n\nroot = tk.Tk()\nroot.title(\"Proxy Finder\")\n\nproxy_text = tk.Text(root)\nproxy_text.pack()\n\nfind_button = tk.Button(root, text=\"Find Proxies\", command=on_find_clicked)\nfind_button.pack()\n\nroot.mainloop()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6ce8\u610f\u6b64\u5e93\u4f7f\u7528python3.7\u7248\uff0c\u907f\u5751\uff0c\u5426\u5219\u8fd0\u884c\u65f6\u51fa\u9519\uff01\uff01\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-4807","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/4807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4807"}],"version-history":[{"count":1,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/4807\/revisions"}],"predecessor-version":[{"id":4808,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/4807\/revisions\/4808"}],"wp:attachment":[{"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4807"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xc.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}