本文整理匯總了Python中pykolab.imap.IMAP.get_quota方法的典型用法代碼示例。如果您正苦於以下問題:Python IMAP.get_quota方法的具體用法?Python IMAP.get_quota怎麽用?Python IMAP.get_quota使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pykolab.imap.IMAP
的用法示例。
在下文中一共展示了IMAP.get_quota方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: IMAP
# 需要導入模塊: from pykolab.imap import IMAP [as 別名]
# 或者: from pykolab.imap.IMAP import get_quota [as 別名]
except IndexError, e:
quota_folder = '*'
imap = IMAP()
if not conf.connect_server == None:
imap.connect(server=conf.connect_server)
else:
imap.connect()
folders = []
quota_folders = imap.list_folders(quota_folder)
for quota_folder in quota_folders:
try:
(used, quota) = imap.get_quota(quota_folder)
print "Folder: %s" % (quota_folder)
if not used == None and not quota == None:
if quota == 0:
print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
print "%d (Used: %d, Percentage: %s)" % (quota, used, u'\u221E')
else:
percentage = round(((float)(used)/(float)(quota)) * 100.0, 1)
print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
else:
if used == None:
print "%d (Used: %d, Percentage: %d)" % (quota, 0, 0)
else:
print "No quota"
except:
try: