Authomatic internet connection
Peter Hansen
peter at engcorp.com
Sat May 4 23:17:53 EDT 2002
[Reposting since all my outbound news has been swallowed for the last week.
Originally posted April 30.]
Max wrote:
>
> Hi, i'm a new Python-enthusiast. Really GREAT language, i'm having much fun
> with it!!!
> (Sorry, but i had to communicate this to the whole world... :) )
You /are/ preaching to the converted, but don't feel the need to apologize. :-)
> Now, a little question: i wrote a very simple script that sends an
> authomatic e-mail message using smtplib. Short, simple and working!
> I would like to know if someone knows how to automatically connect to
> Internet (i'm playing with windows (98 and Xp). It would be nice even to
> bring up authomatically a connection, somehow like the webbrowser package
> does when opening a "http" url) before trying to send the message.
Investigate the win32all package by Mark Hammond, and specifically
the win32ras module, as demonstrated in the demos/rastest.py file.
For example, on my machine right now:
C:\a\python\win32\demos> python rastest.py -l
All phone-book entries:
Intranet
My Connection
Current Connections:
(-2101587008, 'Intranet', 'vpn', 'Microsoft VPN Adapter')
C:\a\python\win32\demos> python rastest.py -d Intranet
Disconnected from Intranet
C:\a\python\win32\demos> python rastest.py -c Intranet
hras: 0x82bc53c0, rc: 0x0000
(and I'm back on my VPN connection to work...)
-Peter
More information about the Python-list
mailing list