Re: Get the IP address of WIFI interface

2011-05-16 Thread Jun Hu
Thanks, this code works perfectly in ubuntu 10.04. one question though, is dbus usually implemented in other distribution of linux? On Mon, May 16, 2011 at 12:57 PM, Anssi Saari wrote: > Neal Becker writes: > > One possible solution in Linux is asking NetworkManager, if it's in > use. It knows

Re: Get the IP address of WIFI interface

2011-05-16 Thread Anssi Saari
Neal Becker writes: > Here's some useful snippits for linux: > > def get_default_if(): > f = open('/proc/net/route') > for i in csv.DictReader(f, delimiter="\t"): > if long(i['Destination'], 16) == 0: > return i['Iface'] > return None > > def get_ip_address(ifname)

Re: Get the IP address of WIFI interface

2011-05-15 Thread MrJean1
Perhaps, this recipe works for your case: It does parse ifconfig and ipconfig, if found. /Jean On May 15, 2:14 pm, Andrew Berg wrote: > On 2011.05.15 06:12 AM, Tim Golden wrote:> ... and for Windows: > > > > > import wmi > > > for nic in wmi.WM

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
On Sun, May 15, 2011 at 2:14 PM, Andrew Berg wrote: > > One thing I found out about Win32_NetworkAdapterConfiguration is that it > only contains /current/ information and not the stored info that it uses > when making an initial connection (you can see and edit this info in the > Network and Shari

Re: Get the IP address of WIFI interface

2011-05-15 Thread Andrew Berg
On 2011.05.15 06:12 AM, Tim Golden wrote: > ... and for Windows: > > > import wmi > > for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1): >print nic.Caption, nic.IPAddress > > One thing I found out about Win32_NetworkAdapterConfiguration is that it only contains /current/ i

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 20:23, Jun Hu wrote: Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in wmi.WMI().Win32_NetworkAdapter():

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 12:04 PM, Neal Becker wrote: Far.Runner wrote: Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface

Re: Get the IP address of WIFI interface

2011-05-15 Thread Neal Becker
Far.Runner wrote: > Hi python experts: > There are two network interfaces on my laptop: one is 100M Ethernet > interface, the other is wifi interface, both are connected and has an ip > address. > The question is: How to get the ip address of the wifi interface in a python > script without parsing

Get the IP address of WIFI interface

2011-05-13 Thread Far.Runner
Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface in a python script without parsing the output of a shell command