本文整理匯總了Python中nntplib.NNTPError方法的典型用法代碼示例。如果您正苦於以下問題:Python nntplib.NNTPError方法的具體用法?Python nntplib.NNTPError怎麽用?Python nntplib.NNTPError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nntplib
的用法示例。
在下文中一共展示了nntplib.NNTPError方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_zlogin
# 需要導入模塊: import nntplib [as 別名]
# 或者: from nntplib import NNTPError [as 別名]
def test_zlogin(self):
# This test must be the penultimate because further commands will be
# refused.
baduser = "notarealuser"
badpw = "notarealpassword"
# Check that bogus credentials cause failure
self.assertRaises(nntplib.NNTPError, self.server.login,
user=baduser, password=badpw, usenetrc=False)
# FIXME: We should check that correct credentials succeed, but that
# would require valid details for some server somewhere to be in the
# test suite, I think. Gmane is anonymous, at least as used for the
# other tests.
示例2: test_module_all_attribute
# 需要導入模塊: import nntplib [as 別名]
# 或者: from nntplib import NNTPError [as 別名]
def test_module_all_attribute(self):
self.assertTrue(hasattr(nntplib, '__all__'))
target_api = ['NNTP', 'NNTPError', 'NNTPReplyError',
'NNTPTemporaryError', 'NNTPPermanentError',
'NNTPProtocolError', 'NNTPDataError', 'decode_header']
if ssl is not None:
target_api.append('NNTP_SSL')
self.assertEqual(set(nntplib.__all__), set(target_api))
示例3: run
# 需要導入模塊: import nntplib [as 別名]
# 或者: from nntplib import NNTPError [as 別名]
def run(self):
value = getword()
try:
print "-"*12
print "User:",user[:-1],"Password:",value
n = nntplib.NNTP(ip,119,user,value)
print "\t\nLogin successful:",user, value
n.quit()
work.join()
sys.exit(2)
except(nntplib.NNTPError, socket.gaierror, socket.error, socket.herror), msg:
print "An error occurred:", msg
pass
示例4: run
# 需要導入模塊: import nntplib [as 別名]
# 或者: from nntplib import NNTPError [as 別名]
def run(self):
value = getword()
try:
print "-"*12
print "User:",user[:-1],"Password:",value
n = nntplib.NNTP(ipaddr[0],119,user,value)
print "\t\nLogin successful:",user, value
n.quit()
work.join()
sys.exit(2)
except (nntplib.NNTPError, socket.gaierror, socket.error, socket.herror), msg:
#print "An error occurred:", msg
pass
示例5: run
# 需要導入模塊: import nntplib [as 別名]
# 或者: from nntplib import NNTPError [as 別名]
def run(self):
value, user = getword()
try:
print "-"*12
print "User:",user,"Password:",value
n = nntplib.NNTP(sys.argv[1],int(sys.argv[2]),user,value)
print "\t\nLogin successful:",value, user
n.quit()
work.join()
sys.exit(2)
except(nntplib.NNTPError, socket.gaierror, socket.error, socket.herror), msg:
print "An error occurred:", msg
pass