{"id":787,"date":"2021-11-24T22:31:07","date_gmt":"2021-11-24T14:31:07","guid":{"rendered":"https:\/\/dasmz.com\/?p=787"},"modified":"2021-11-24T22:37:24","modified_gmt":"2021-11-24T14:37:24","slug":"%e9%80%9a%e7%94%a8%e4%bb%a3%e7%90%86%e6%b1%a0%e9%a1%b9%e7%9b%ae%ef%bc%8c%e5%8a%9f%e8%83%bd%e5%9e%8b%e5%87%bd%e6%95%b0%ef%bc%8c%e6%a3%80%e6%b5%8b%e9%80%9a%e7%94%a8%e4%bb%a3%e7%90%86%e6%98%af%e5%90%a6","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=787","title":{"rendered":"\u901a\u7528\u4ee3\u7406\u6c60\u9879\u76ee\uff0c\u529f\u80fd\u578b\u51fd\u6570\uff0c\u68c0\u6d4b\u901a\u7528\u4ee3\u7406\u662f\u5426\u53ef\u7528 2021-11-24"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">\/\/ \u4f9d\u8d56\u76842\u4e2a\u6a21\u5757\n\n# pip3 install requests   # \u7f51\u7edc\u8bf7\u6c42\u7684\n# pip3 install pysocks    # \u652f\u6301socks\u7684\n<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">import requests \n\ndef checkProxyStatus(TargetURL, aUA, aProxy, aTimeout):\n    \"\"\"\n        runCheckProxyStatus(TargetURL, aUA, aProxy, aTimeout)\n        \u4f9d\u8d56\u6a21\u5757 requests  pysocks\n        \u53c2\u6570 TargetURL \u7528\u4e8e\u68c0\u6d4b\u7684\u4e00\u4e2a\u7f51\u7ad9\u5730\u5740\n        \u53c2\u6570 aUA \u4e00\u4e2a\u968f\u673a\u7684User-Agent\n        \u53c2\u6570 aProxy \u9700\u8981\u68c0\u6d4b\u7684\u90a3\u4e2a\u4ee3\u7406 \u683c\u5f0f\u4e3a vtype:\/\/ip:port\n        \u53c2\u6570 aTimeout \u8d85\u65f6\u7684\u65f6\u95f4\n        \u8fd4\u56de\u503c\uff0c\u4f9d\u636e\u72b6\u6001\u7801\u662f\u5426\u4e3a200\uff0c\u5224\u5b9a\u4e3a\u662f\uff0c\u8fd4\u56de \u5b57\u7b26 Y\n        \u8fd4\u56de\u503c\uff0c\u4f9d\u636e\u72b6\u6001\u7801\u662f\u5426\u4e3a200\uff0c\u5224\u5b9a\u4e3a\u5426\uff0c\u8fd4\u56de \u5b57\u7b26 N\n\n    \"\"\"\n    try:\n        myHeader = {\"User-Agent\": aUA}\n        myProxy = {'http': aProxy, 'https': aProxy}\n        aRSP = requests.get(url = TargetURL, headers = myHeader, proxies = myProxy, timeout = aTimeout)\n        if aRSP.status_code == 200:\n            return 'Y'\n        else:\n            return 'N'\n    except Exception as e:\n        return 'N'<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u5b9e\u9645\u6d4b\u4e86\u5982\u4e0b\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u901a\u8fc7\u3002\n\nimport requests\n\ndef checkProxyStatus(TargetURL, aUA, aProxy, aTimeout):\n    \"\"\"\n        runCheckProxyStatus(TargetURL, aUA, aProxy, aTimeout)\n        \u4f9d\u8d56\u6a21\u5757 requests  pysocks\n        \u53c2\u6570 TargetURL \u7528\u4e8e\u68c0\u6d4b\u7684\u4e00\u4e2a\u7f51\u7ad9\u5730\u5740\n        \u53c2\u6570 aUA \u4e00\u4e2a\u968f\u673a\u7684User-Agent\n        \u53c2\u6570 aProxy \u9700\u8981\u68c0\u6d4b\u7684\u90a3\u4e2a\u4ee3\u7406 \u683c\u5f0f\u4e3a vtype:\/\/ip:port\n        \u53c2\u6570 aTimeout \u8d85\u65f6\u7684\u65f6\u95f4\n        \u8fd4\u56de\u503c\uff0c\u4f9d\u636e\u72b6\u6001\u7801\u662f\u5426\u4e3a200\uff0c\u5224\u5b9a\u4e3a\u662f\uff0c\u8fd4\u56de \u5b57\u7b26 Y\n        \u8fd4\u56de\u503c\uff0c\u4f9d\u636e\u72b6\u6001\u7801\u662f\u5426\u4e3a200\uff0c\u5224\u5b9a\u4e3a\u5426\uff0c\u8fd4\u56de \u5b57\u7b26 N\n\n    \"\"\"\n    try:\n        myHeader = {\"User-Agent\": aUA}\n        myProxy = {'http': aProxy, 'https': aProxy}\n        aRSP = requests.get(url = TargetURL, headers = myHeader, proxies = myProxy, timeout = aTimeout)\n        if aRSP.status_code == 200:\n            return 'Y'\n        else:\n            return 'N'\n    except Exception as e:\n        return 'N'\n        \n        \nv = checkProxyStatus(TargetURL = 'https:\/\/www.duckduckgo.com', aUA = 'Python', aProxy = 'socks5:\/\/127.0.0.1:10808', aTimeout = 3)\nprint(v)\n\n# \u5728\u672c\u573010808\u7684v2\u4ee3\u7406\u5f00\u7740\u65f6\u5019\uff0c\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u6b63\u5e38\u8fd4\u56de \u5b57\u7b26 Y<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\"\/><figcaption>\u4e91\u4e5e\u8ba8<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ \u4f9d\u8d56\u76842\u4e2a\u6a21\u5757 # pip3 install requests # \u7f51\u7edc\u8bf7\u6c42\u7684 # pip3 insta [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/787"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=787"}],"version-history":[{"count":3,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/787\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/787\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}