Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
poplib.POP3_SSL Class Reference
Inheritance diagram for poplib.POP3_SSL:
Inheritance graph
[legend]
Collaboration diagram for poplib.POP3_SSL:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getwelcome
def set_debuglevel
def user
def pass_
def stat
def list
def retr
def dele
def noop
def rset
def quit
def rpop
def apop
def top
def uidl

Public Attributes

 keyfile
 certfile
 context
 host
 port
 sock
 file
 welcome

Static Public Attributes

string encoding = 'UTF-8'
tuple timestamp = re.compile(br'\+OK.*(<[^>]+>)')

Private Member Functions

def _create_socket

Detailed Description

POP3 client class over SSL connection

Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None)

       hostname - the hostname of the pop3 over ssl server
       port - port number
       keyfile - PEM formatted file that countains your private key
       certfile - PEM formatted certificate chain file

See the methods of the parent class POP3 for more documentation.

Definition at line 321 of file poplib.py.


Constructor & Destructor Documentation

def poplib.POP3_SSL.__init__ (   self,
  host,
  port = POP3_SSL_PORT,
  keyfile = None,
  certfile = None,
  timeout = socket._GLOBAL_DEFAULT_TIMEOUT,
  context = None 
)

Definition at line 335 of file poplib.py.

00335 
00336                      timeout=socket._GLOBAL_DEFAULT_TIMEOUT, context=None):
00337             if context is not None and keyfile is not None:
00338                 raise ValueError("context and keyfile arguments are mutually "
00339                                  "exclusive")
00340             if context is not None and certfile is not None:
00341                 raise ValueError("context and certfile arguments are mutually "
00342                                  "exclusive")
00343             self.keyfile = keyfile
00344             self.certfile = certfile
00345             self.context = context
00346             POP3.__init__(self, host, port, timeout)

Here is the caller graph for this function:


Member Function Documentation

def poplib.POP3_SSL._create_socket (   self,
  timeout 
) [private]

Reimplemented from poplib.POP3.

Definition at line 347 of file poplib.py.

00347 
00348         def _create_socket(self, timeout):
00349             sock = POP3._create_socket(self, timeout)
00350             if self.context is not None:
00351                 sock = self.context.wrap_socket(sock)
00352             else:
00353                 sock = ssl.wrap_socket(sock, self.keyfile, self.certfile)
00354             return sock
00355 
    __all__.append("POP3_SSL")

Here is the call graph for this function:

def poplib.POP3.apop (   self,
  user,
  password 
) [inherited]
Authorisation

- only possible if server has supplied a timestamp in initial greeting.

Args:
user     - mailbox user;
password - mailbox password.

NB: mailbox is locked by server from here to 'quit()'

Definition at line 274 of file poplib.py.

00274 
00275     def apop(self, user, password):
00276         """Authorisation
00277 
00278         - only possible if server has supplied a timestamp in initial greeting.
00279 
00280         Args:
00281                 user     - mailbox user;
00282                 password - mailbox password.
00283 
00284         NB: mailbox is locked by server from here to 'quit()'
00285         """
00286         secret = bytes(password, self.encoding)
00287         m = self.timestamp.match(self.welcome)
00288         if not m:
00289             raise error_proto('-ERR APOP not supported by server')
00290         import hashlib
00291         digest = m.group(1)+secret
00292         digest = hashlib.md5(digest).hexdigest()
00293         return self._shortcmd('APOP %s %s' % (user, digest))
00294 

Here is the call graph for this function:

def poplib.POP3.dele (   self,
  which 
) [inherited]
Delete message number 'which'.

Result is 'response'.

Definition at line 230 of file poplib.py.

00230 
00231     def dele(self, which):
00232         """Delete message number 'which'.
00233 
00234         Result is 'response'.
00235         """
00236         return self._shortcmd('DELE %s' % which)
00237 

Here is the call graph for this function:

def poplib.POP3.getwelcome (   self) [inherited]

Definition at line 167 of file poplib.py.

00167 
00168     def getwelcome(self):
00169         return self.welcome
00170 

def poplib.POP3.list (   self,
  which = None 
) [inherited]
Request listing, return result.

Result without a message number argument is in form
['response', ['mesg_num octets', ...], octets].

Result when a message number argument is given is a
single response: the "scan listing" for that message.

Definition at line 208 of file poplib.py.

00208 
00209     def list(self, which=None):
00210         """Request listing, return result.
00211 
00212         Result without a message number argument is in form
00213         ['response', ['mesg_num octets', ...], octets].
00214 
00215         Result when a message number argument is given is a
00216         single response: the "scan listing" for that message.
00217         """
00218         if which is not None:
00219             return self._shortcmd('LIST %s' % which)
00220         return self._longcmd('LIST')
00221 

Here is the call graph for this function:

Here is the caller graph for this function:

def poplib.POP3.noop (   self) [inherited]
Does nothing.

One supposes the response indicates the server is alive.

Definition at line 238 of file poplib.py.

00238 
00239     def noop(self):
00240         """Does nothing.
00241 
00242         One supposes the response indicates the server is alive.
00243         """
00244         return self._shortcmd('NOOP')
00245 

Here is the call graph for this function:

def poplib.POP3.pass_ (   self,
  pswd 
) [inherited]
Send password, return response

(response includes message count, mailbox size).

NB: mailbox is locked by server from here to 'quit()'

Definition at line 185 of file poplib.py.

00185 
00186     def pass_(self, pswd):
00187         """Send password, return response
00188 
00189         (response includes message count, mailbox size).
00190 
00191         NB: mailbox is locked by server from here to 'quit()'
00192         """
00193         return self._shortcmd('PASS %s' % pswd)
00194 

Here is the call graph for this function:

def poplib.POP3.quit (   self) [inherited]
Signoff: commit changes on server, unlock mailbox, close connection.

Definition at line 251 of file poplib.py.

00251 
00252     def quit(self):
00253         """Signoff: commit changes on server, unlock mailbox, close connection."""
00254         try:
00255             resp = self._shortcmd('QUIT')
00256         except error_proto as val:
00257             resp = val
00258         self.file.close()
00259         self.sock.close()
00260         del self.file, self.sock
00261         return resp

Here is the call graph for this function:

Here is the caller graph for this function:

def poplib.POP3.retr (   self,
  which 
) [inherited]
Retrieve whole message number 'which'.

Result is in form ['response', ['line', ...], octets].

Definition at line 222 of file poplib.py.

00222 
00223     def retr(self, which):
00224         """Retrieve whole message number 'which'.
00225 
00226         Result is in form ['response', ['line', ...], octets].
00227         """
00228         return self._longcmd('RETR %s' % which)
00229 

Here is the call graph for this function:

def poplib.POP3.rpop (   self,
  user 
) [inherited]
Not sure what this does.

Definition at line 267 of file poplib.py.

00267 
00268     def rpop(self, user):
00269         """Not sure what this does."""
00270         return self._shortcmd('RPOP %s' % user)
00271 

Here is the call graph for this function:

def poplib.POP3.rset (   self) [inherited]
Unmark all messages marked for deletion.

Definition at line 246 of file poplib.py.

00246 
00247     def rset(self):
00248         """Unmark all messages marked for deletion."""
00249         return self._shortcmd('RSET')
00250 

Here is the call graph for this function:

Here is the caller graph for this function:

def poplib.POP3.set_debuglevel (   self,
  level 
) [inherited]

Definition at line 171 of file poplib.py.

00171 
00172     def set_debuglevel(self, level):
00173         self._debugging = level
00174 

def poplib.POP3.stat (   self) [inherited]
Get mailbox status.

Result is tuple of 2 ints (message count, mailbox size)

Definition at line 195 of file poplib.py.

00195 
00196     def stat(self):
00197         """Get mailbox status.
00198 
00199         Result is tuple of 2 ints (message count, mailbox size)
00200         """
00201         retval = self._shortcmd('STAT')
00202         rets = retval.split()
00203         if self._debugging: print('*stat*', repr(rets))
00204         numMessages = int(rets[1])
00205         sizeMessages = int(rets[2])
00206         return (numMessages, sizeMessages)
00207 

Here is the call graph for this function:

def poplib.POP3.top (   self,
  which,
  howmuch 
) [inherited]
Retrieve message header of message number 'which'
and first 'howmuch' lines of message body.

Result is in form ['response', ['line', ...], octets].

Definition at line 295 of file poplib.py.

00295 
00296     def top(self, which, howmuch):
00297         """Retrieve message header of message number 'which'
00298         and first 'howmuch' lines of message body.
00299 
00300         Result is in form ['response', ['line', ...], octets].
00301         """
00302         return self._longcmd('TOP %s %s' % (which, howmuch))
00303 

Here is the call graph for this function:

def poplib.POP3.uidl (   self,
  which = None 
) [inherited]
Return message digest (unique id) list.

If 'which', result contains unique id for that message
in the form 'response mesgnum uid', otherwise result is
the list ['response', ['mesgnum uid', ...], octets]

Definition at line 304 of file poplib.py.

00304 
00305     def uidl(self, which=None):
00306         """Return message digest (unique id) list.
00307 
00308         If 'which', result contains unique id for that message
00309         in the form 'response mesgnum uid', otherwise result is
00310         the list ['response', ['mesgnum uid', ...], octets]
00311         """
00312         if which is not None:
00313             return self._shortcmd('UIDL %s' % which)
00314         return self._longcmd('UIDL')
00315 
try:

Here is the call graph for this function:

def poplib.POP3.user (   self,
  user 
) [inherited]
Send user name, return response

(should indicate password required).

Definition at line 177 of file poplib.py.

00177 
00178     def user(self, user):
00179         """Send user name, return response
00180 
00181         (should indicate password required).
00182         """
00183         return self._shortcmd('USER %s' % user)
00184 

Here is the call graph for this function:


Member Data Documentation

Definition at line 343 of file poplib.py.

Definition at line 344 of file poplib.py.

string poplib.POP3.encoding = 'UTF-8' [static, inherited]

Definition at line 78 of file poplib.py.

poplib.POP3.file [inherited]

Definition at line 85 of file poplib.py.

poplib.POP3.host [inherited]

Definition at line 82 of file poplib.py.

Definition at line 342 of file poplib.py.

poplib.POP3.port [inherited]

Definition at line 83 of file poplib.py.

poplib.POP3.sock [inherited]

Definition at line 84 of file poplib.py.

tuple poplib.POP3.timestamp = re.compile(br'\+OK.*(<[^>]+>)') [static, inherited]

Definition at line 272 of file poplib.py.

poplib.POP3.welcome [inherited]

Definition at line 87 of file poplib.py.


The documentation for this class was generated from the following file: