Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5421

Re: Get the IP address of WIFI interface

Date 2011-05-15 12:12 +0100
From Tim Golden <mail@timgolden.me.uk>
Subject Re: Get the IP address of WIFI interface
References <BANLkTi=YN7CW_y3w5EK-36uPwPcxXgPm8A@mail.gmail.com> <iqobvs$3jn$1@dough.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.1592.1305457939.9059.python-list@python.org> (permalink)

Show all headers | View raw


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 in a python
>> script without parsing the output of a shell command like "ipconfig" or
>> "ifconfig"?
>>
>> OS: Windows or Linux
>>
>> F.R
>
> Here's some useful snippits for linux:

... and for Windows:

<code>
import wmi

for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1):
   print nic.Caption, nic.IPAddress

</code>

TJG

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Get the IP address of WIFI interface Tim Golden <mail@timgolden.me.uk> - 2011-05-15 12:12 +0100

csiph-web