Created
April 2, 2020 10:38
-
-
Save tuxmartin/700d33548156269712e6d9de63b5d6ad to your computer and use it in GitHub Desktop.
Vypsani stavu IMAP kvoty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imaplib, re | |
import os | |
p = re.compile('d+') | |
# --------------------------------- | |
login="[email protected]" | |
password="password123" | |
imap_server="example.net" | |
imap_port=993 | |
# --------------------------------- | |
M = imaplib.IMAP4_SSL(imap_server, imap_port) | |
M.login(login, password) | |
quotaStr = M.getquotaroot("INBOX")[1][1][0] | |
r = re.compile('\d+').findall(quotaStr.decode('utf-8')) | |
if r == []: | |
r.append(0) | |
r.append(0) | |
total = float(r[1])/1000 | |
used = float(r[0])/1000 | |
print('Quota = %d MB'%( int(total) )) | |
print('Used = %d MB'%( int(used) )) | |
M.logout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment