gdata.tlslite.integration.IMAP4_TLS | index /usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/integration/IMAP4_TLS.py

`TLS Lite + imaplib.`

Modules

``

socket |  |  |

Classes

``

gdata.tlslite.integration.ClientHelper.ClientHelper
  IMAP4_TLS(imaplib.IMAP4, gdata.tlslite.integration.ClientHelper.ClientHelper)
imaplib.IMAP4
  IMAP4_TLS(imaplib.IMAP4, gdata.tlslite.integration.ClientHelper.ClientHelper)

class IMAP4_TLS(imaplib.IMAP4, gdata.tlslite.integration.ClientHelper.ClientHelper)
`` | `This class extends L{imaplib.IMAP4} with TLS support.`

Method resolution order:
  IMAP4_TLS
  imaplib.IMAP4
  gdata.tlslite.integration.ClientHelper.ClientHelper

Methods defined here:

__init__(self, host='', port=993, username=None, password=None, sharedKey=None, certChain=None, privateKey=None, cryptoID=None, protocol=None, x509Fingerprint=None, x509TrustList=None, x509CommonName=None, settings=None)
  `Create a new IMAP4_TLS.
  For client authentication, use one of these argument
  combinations:
  - username, password (SRP)
  - username, sharedKey (shared-key)
  - certChain, privateKey (certificate)
  For server authentication, you can either rely on the
  implicit mutual authentication performed by SRP or
  shared-keys, or you can do certificate-based server
  authentication with one of these argument combinations:
  - cryptoID[, protocol] (requires cryptoIDlib)
  - x509Fingerprint
  - x509TrustList[, x509CommonName] (requires cryptlib_py)
  Certificate-based server authentication is compatible with
  SRP or certificate-based client authentication. It is
  not compatible with shared-keys.
  The caller should be prepared to handle TLS-specific
  exceptions. See the client handshake functions in
  L{tlslite.TLSConnection.TLSConnection} for details on which
  exceptions might be raised.
  @type host: str
  @param host: Server to connect to.
  @type port: int
  @param port: Port to connect to.
  @type username: str
  @param username: SRP or shared-key username. Requires the
  'password' or 'sharedKey' argument.
  @type password: str
  @param password: SRP password for mutual authentication.
  Requires the 'username' argument.
  @type sharedKey: str
  @param sharedKey: Shared key for mutual authentication.
  Requires the 'username' argument.
  @type certChain: L{tlslite.X509CertChain.X509CertChain} or
  L{cryptoIDlib.CertChain.CertChain}
  @param certChain: Certificate chain for client authentication.
  Requires the 'privateKey' argument. Excludes the SRP or
  shared-key related arguments.
  @type privateKey: L{tlslite.utils.RSAKey.RSAKey}
  @param privateKey: Private key for client authentication.
  Requires the 'certChain' argument. Excludes the SRP or
  shared-key related arguments.
  @type cryptoID: str
  @param cryptoID: cryptoID for server authentication. Mutually
  exclusive with the 'x509...' arguments.
  @type protocol: str
  @param protocol: cryptoID protocol URI for server
  authentication. Requires the 'cryptoID' argument.
  @type x509Fingerprint: str
  @param x509Fingerprint: Hex-encoded X.509 fingerprint for
  server authentication. Mutually exclusive with the 'cryptoID'
  and 'x509TrustList' arguments.
  @type x509TrustList: list of L{tlslite.X509.X509}
  @param x509TrustList: A list of trusted root certificates. The
  other party must present a certificate chain which extends to
  one of these root certificates. The cryptlib_py module must be
  installed to use this parameter. Mutually exclusive with the
  'cryptoID' and 'x509Fingerprint' arguments.
  @type x509CommonName: str
  @param x509CommonName: The end-entity certificate's 'CN' field
  must match this value. For a web server, this is typically a
  server name such as 'www.amazon.com'. Mutually exclusive with
  the 'cryptoID' and 'x509Fingerprint' arguments. Requires the
  'x509TrustList' argument.
  @type settings: L{tlslite.HandshakeSettings.HandshakeSettings}
  @param settings: Various settings which can be used to control
  the ciphersuites, certificate types, and SSL/TLS versions
  offered by the client.`

open(self, host='', port=993)
  `Setup connection to remote server on "host:port".
  This connection will be used by the routines:
  read, readline, send, shutdown.`

Methods inherited from imaplib.IMAP4:

__getattr__(self, attr)

append(self, mailbox, flags, date_time, message)
  `Append message to named mailbox.
  (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)
  All args except `message' can be None.`

authenticate(self, mechanism, authobject)
  `Authenticate command - requires response processing.
  'mechanism' specifies which authentication mechanism is to
  be used - it must appear in <instance>.capabilities in the
  form AUTH=<mechanism>.
  'authobject' must be a callable object:
  data = authobject(response)
  It will be called to process server continuation responses.
  It should return data that will be encoded and sent to server.
  It should return None if the client abort response '*' should
  be sent instead.`

capability(self)
  `(typ, [data]) = <instance>.capability()
  Fetch capabilities list from server.`

check(self)
  `Checkpoint mailbox on server.
  (typ, [data]) = <instance>.check()`

close(self)
  `Close currently selected mailbox.
  Deleted messages are removed from writable mailbox.
  This is the recommended command before 'LOGOUT'.
  (typ, [data]) = <instance>.close()`

copy(self, message_set, new_mailbox)
  `Copy 'message_set' messages onto end of 'new_mailbox'.
  (typ, [data]) = <instance>.copy(message_set, new_mailbox)`

create(self, mailbox)
  `Create new mailbox.
  (typ, [data]) = <instance>.create(mailbox)`

delete(self, mailbox)
  `Delete old mailbox.
  (typ, [data]) = <instance>.delete(mailbox)`

deleteacl(self, mailbox, who)
  `Delete the ACLs (remove any rights) set for who on mailbox.
  (typ, [data]) = <instance>.deleteacl(mailbox, who)`

expunge(self)
  `Permanently remove deleted items from selected mailbox.
  Generates 'EXPUNGE' response for each deleted message.
  (typ, [data]) = <instance>.expunge()
  'data' is list of 'EXPUNGE'd message numbers in order received.`

fetch(self, message_set, message_parts)
  `Fetch (parts of) messages.
  (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)
  'message_parts' should be a string of selected parts
  enclosed in parentheses, eg: "(UID BODY[TEXT])".
  'data' are tuples of message part envelope and data.`

getacl(self, mailbox)
  `Get the ACLs for a mailbox.
  (typ, [data]) = <instance>.getacl(mailbox)`

getannotation(self, mailbox, entry, attribute)
  `(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
  Retrieve ANNOTATIONs.`

getquota(self, root)
  `Get the quota root's resource usage and limits.
  Part of the IMAP4 QUOTA extension defined in rfc2087.
  (typ, [data]) = <instance>.getquota(root)`

getquotaroot(self, mailbox)
  `Get the list of quota roots for the named mailbox.
  (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)`

list(self, directory='""', pattern='*')
  `List mailbox names in directory matching pattern.
  (typ, [data]) = <instance>.list(directory='""', pattern='*')
  'data' is list of LIST responses.`

login(self, user, password)
  `Identify client using plaintext password.
  (typ, [data]) = <instance>.login(user, password)
  NB: 'password' will be quoted.`

login_cram_md5(self, user, password)
  `Force use of CRAM-MD5 authentication.
  (typ, [data]) = <instance>.login_cram_md5(user, password)`

logout(self)
  `Shutdown connection to server.
  (typ, [data]) = <instance>.logout()
  Returns server 'BYE' response.`

lsub(self, directory='""', pattern='*')
  `List 'subscribed' mailbox names in directory matching pattern.
  (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')
  'data' are tuples of message part envelope and data.`

myrights(self, mailbox)
  `Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).
  (typ, [data]) = <instance>.myrights(mailbox)`

namespace(self)
  `Returns IMAP namespaces ala rfc2342
  (typ, [data, ...]) = <instance>.namespace()`

noop(self)
  `Send NOOP command.
  (typ, [data]) = <instance>.noop()`

partial(self, message_num, message_part, start, length)
  `Fetch truncated part of a message.
  (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)
  'data' is tuple of message part envelope and data.`

print_log(self)

proxyauth(self, user)
  `Assume authentication as "user".
  Allows an authorised administrator to proxy into any user's
  mailbox.
  (typ, [data]) = <instance>.proxyauth(user)`

read(self, size)
  `Read 'size' bytes from remote.`

readline(self)
  `Read line from remote.`

recent(self)
  `Return most recent 'RECENT' responses if any exist,
  else prompt server for an update using the 'NOOP' command.
  (typ, [data]) = <instance>.recent()
  'data' is None if no new messages,
  else list of RECENT responses, most recent last.`

rename(self, oldmailbox, newmailbox)
  `Rename old mailbox name to new.
  (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)`

response(self, code)
  `Return data for response 'code' if received, or None.
  Old value for response 'code' is cleared.
  (code, [data]) = <instance>.response(code)`

search(self, charset, *criteria)
  `Search mailbox for matching messages.
  (typ, [data]) = <instance>.search(charset, criterion, ...)
  'data' is space separated list of matching message numbers.`

select(self, mailbox='INBOX', readonly=False)
  `Select a mailbox.
  Flush all untagged responses.
  (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)
  'data' is count of messages in mailbox ('EXISTS' response).
  Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
  other responses should be obtained via <instance>.response('FLAGS') etc.`

send(self, data)
  `Send data to remote.`

setacl(self, mailbox, who, what)
  `Set a mailbox acl.
  (typ, [data]) = <instance>.setacl(mailbox, who, what)`

setannotation(self, *args)
  `(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
  Set ANNOTATIONs.`

setquota(self, root, limits)
  `Set the quota root's resource limits.
  (typ, [data]) = <instance>.setquota(root, limits)`

shutdown(self)
  `Close I/O established in "open".`

socket(self)
  `Return socket instance used to connect to IMAP4 server.
  socket = <instance>.socket()`

sort(self, sort_criteria, charset, *search_criteria)
  `IMAP4rev1 extension SORT command.
  (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)`

status(self, mailbox, names)
  `Request named status conditions for mailbox.
  (typ, [data]) = <instance>.status(mailbox, names)`

store(self, message_set, command, flags)
  `Alters flag dispositions for messages in mailbox.
  (typ, [data]) = <instance>.store(message_set, command, flags)`

subscribe(self, mailbox)
  `Subscribe to new mailbox.
  (typ, [data]) = <instance>.subscribe(mailbox)`

thread(self, threading_algorithm, charset, *search_criteria)
  `IMAPrev1 extension THREAD command.
  (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)`

uid(self, command, *args)
  `Execute "command arg ..." with messages identified by UID,
  rather than message number.
  (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)
  Returns response appropriate to 'command'.`

unsubscribe(self, mailbox)
  `Unsubscribe from old mailbox.
  (typ, [data]) = <instance>.unsubscribe(mailbox)`

xatom(self, name, *args)
  `Allow simple extension commands
  notified by server in CAPABILITY response.
  Assumes command is legal in current state.
  (typ, [data]) = <instance>.xatom(name, arg, ...)
  Returns response appropriate to extension command `name'.`

Data and other attributes inherited from imaplib.IMAP4:

abort = <class 'imaplib.abort'>

error = <class 'imaplib.error'>

mustquote = <_sre.SRE_Pattern object>

readonly = <class 'imaplib.readonly'>

Data
`` |  | IMAP4_TLS_PORT = 993