0
我使用此代碼檢查域可用性域可用性:穩定的方法來檢查與pywhois
try:
w = pywhois.whois('honarasai.com')
if not w:
message='Domain is available'
except:
message='Domain is taken'
它返回這樣的結果:
creation_date: ['11-jun-2012'] domain_name: ['HONARASAI.COM', 'honarasai.com'] emails: ['[email protected]', '[email protected]', '[email protected]', '[email protected]'] expiration_date: ['11-jun-2013'] name_servers: ['NS.HONARASAI.COM', 'NS2.HONARASAI.COM'] referral_url: ['http://www.OnlineNIC.com'] registrar: ['ONLINENIC, INC.'] status: ['clientTransferProhibited'] updated_date: ['11-jun-2012'] whois_server: ['whois.onlinenic.com']
當網絡速度低這是行不通的穩定並返回錯誤的結果。什麼是檢查結果以獲得穩定響應的準確方法?
除了socket.timeout沒有捕獲到這個異常,並且當請求需要很長時間時,這個過程繼續直到產生一個錯誤! – 2012-07-21 07:44:09
那麼,它會引發什麼異常呢? – Simon 2012-07-21 08:28:52
getaddrinfo異常 – 2012-07-21 09:07:35