settings network timeouts in python
Steve Holden
steve at holdenweb.com
Mon Dec 19 12:13:17 EST 2005
Narendra wrote:
> Hi All,
>
> I have a problem here. I'm connecting to some pop server.Here i need to
> set the network timeouts,since some times my program disconnecting from
> net at tht point of time I'm unable to connect to POP server. Can any
> one provide the solution for it.
>
> code;
>
> import poplib
> m=poplib.POP3('pop.mail.yahoo.com',110)
> m.user('XXX')
> m.pass_('XXX')
> # here i need to set the network time out when I'm connecting to POP
> server. i.e in the line
> m=poplib.POP3('pop.mail.yahoo.com')
>
>
> Any help can be greatly appreciated
>
Precede your code with
import socket
socket.setdefaulttimeout(60)
for a one-minute timeout.
Regarding your other problem, I don't know what will make a message be
classified as "bulk" by a particular receiving MTS, you'll have to ask
the operators of the mail server in question.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list