MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / get_interface_ip

Function get_interface_ip

py/test/selenium/webdriver/common/network.py:26–33  ·  view source on GitHub ↗
(ifname)

Source from the content-addressed store, hash-verified

24 import struct
25
26 def get_interface_ip(ifname):
27 def _bytes(value, encoding):
28 return bytes(value, encoding)
29
30 sckt = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
31 return socket.inet_ntoa(
32 fcntl.ioctl(sckt.fileno(), 0x8915, struct.pack("256s", _bytes(ifname[:15], "utf-8")))[20:24] # SIOCGIFADDR
33 )
34
35
36def get_lan_ip():

Callers 1

get_lan_ipFunction · 0.85

Calls 2

_bytesFunction · 0.85
socketMethod · 0.45

Tested by

no test coverage detected