Python3,ProxyIPOrScrapingSpeedOfMethod,Used forIPAddress。ProxyCanProxyAndProxy,ProxyStable,ProxyStableReliable。

Python3 ProxyOfAndApplication:

IP Lock:Settings IP Frequency,, IP ,ProxyAble to。

ScrapingSpeed:ProxyCanConnection,FastScrapingGoalDataOfOf。

:OfOfService,NeedOf,ProxyCan,CanOfData。

,ProxyIP Python3 ImportantOfRole。ProxySecurityIssue,Proxy,NeedNoteSelectOfProxyService,NetworkSecurity。

Work

NeedGetAvailableProxy,Proxy IP AddressAndPortOfGroup, ip:Port Of。ProxyNeedCertification,NeedOfUserPasswordInformation。

OfInstallProxySoftware,Local 7890 PortCreate HTTP ProxyService,Proxy 127.0.0.1:7890。,Software 7891 PortCreate SOCKS ProxyService,Proxy 127.0.0.1:7891,SettingsProxy,CanSuccess IP ProxySoftwareConnectionOfServiceOf IP 。

OfExample,ProxySettingsMethod,CanReplaceOfAvailableProxy。

SettingsProxy,TestOfURL http://httpbin.org/get LinkCanOfInformation,ResultOf origin CustomerOf IP,CanProxySettingsSuccess,Success IP。

,OfProxySettingsMethod。

GetPython3Proxy

DataOf,。ProxyServiceCan,OfMay,ScrapingSuccess。

StaticProxyIP

IPRoyalOfProxyServiceResidentialProxyResolveSolution

IPRoyal
OfStaticProxy

Proxy-seller Data CenterProxy,InternetMarketingOf。

Proxy-seller
OfStaticProxy

Shifter.ioOfProxyService,UserPrivacyProtectionAndOfInternet。

Shifter.io

2. urllib

Of urllib ,ProxyOfSettingsMethod,Code:

 from urllib.error import URLError
 from urllib.request import ProxyHandler, build_opener

 proxy = '127.0.0.1:7890'
 proxy_handler = ProxyHandler({
    'http': 'http://' + proxy,
    'https': 'http://' + proxy
 })
 opener = build_opener(proxy_handler)
 try:
    response = opener.open('https://httpbin.org/get')
    print(response.read().decode('utf-8'))
 except URLError as e:
    print(e.reason)
 

Result:

 {
  "args": {},
  "headers": {
    "Accept-Encoding": "identity",
    "Host": "httpbin.org",
    "User-Agent": "Python-urllib/3.7",
    "X-Amzn-Trace-Id": "Root=1-60e9a1b6-0a20b8a678844a0b2ab4e889"
  },
  "origin": "210.173.1.204",
  "url": "https://httpbin.org/get"
 }
 

Need ProxyHandler SettingsProxy,ParameterType,ProtocolType,Proxy。Note,ProxyNeedProtocol, http:// Or https://,OfLink HTTP ProtocolOf, http OfProxy,OfLink HTTPS ProtocolOf, https OfProxy。ProxySettings HTTP Protocol,Settings http://, HTTP HTTPS ProtocolOfLink,ConfigurationOf HTTP ProtocolOfProxy。

Create ProxyHandler ,Need build_opener MethodCreate Opener, Opener SettingsProxy。 Opener Of open Method,OfLink。

Result JSON, origin,CustomerOf IP。Validation,Of IP ProxyOf IP,Of IP。SuccessSettingsProxy,CanHide IP 。

NeedCertificationOfProxy,CanOfMethodSettings:

 from urllib.error import URLError
 from urllib.request import ProxyHandler, build_opener

 proxy = 'username:password@127.0.0.1:7890'
 proxy_handler = ProxyHandler({
    'http': 'http://' + proxy,
    'https': 'http://' + proxy
 })
 opener = build_opener(proxy_handler)
 try:
    response = opener.open('https://httpbin.org/get')
    print(response.read().decode('utf-8'))
 except URLError as e:
    print(e.reason)
 

Of proxy ,NeedProxyProxyCertificationOfUserPassword, username User,password Password, username foo,Password bar,Proxy foo:bar@127.0.0.1:7890

Proxy SOCKS5 Type,CanSettingsProxy:

 import socks
 import socket
 from urllib import request
 from urllib.error import URLError

 socks.set_default_proxy(socks.SOCKS5, '127.0.0.1', 7891)
 socket.socket = socks.socksocket
 try:
    response = request.urlopen('https://httpbin.org/get')
    print(response.read().decode('utf-8'))
 except URLError as e:
    print(e.reason)
 

Need socks ,CanPassInstall:

 pip3 install PySocks