本文整理汇总了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