import win32ras
import os
if __name__ == '__main__':
params = ('USB-KEY DIAL', '#777','','ctnet@mycdma.cn', 'vnet.mobi','')
fs, ret = win32ras.Dial(None, None, params, None)
print ret
if ret==0:
print win32ras.GetConnectStatus(fs)
data = os.popen("ipconfig", "r").readlines()
have_ppp = 0
ip_str = None
for line in data:
if line.find("USB-KEY DIAL")>=0:
have_ppp = 1
if have_ppp and line.strip().startswith("IP Address"):
ip_str = line.split(":")[1].strip()
have_ppp = 0
print ip_str
windows下利用python拨号电信3G并获得IP地址
最新推荐文章于 2021-10-14 10:35:56 发布