Skip to content

Commit 5e74924

Browse files
authored
Merge pull request #10 from brentru/unpretty-ip
Add Unpretty_ip method
2 parents e41dccf + 892fa6d commit 5e74924

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ def pretty_ip(self, ip): # pylint: disable=no-self-use, invalid-name
265265
"""
266266
return "%d.%d.%d.%d" % (ip[0], ip[1], ip[2], ip[3])
267267

268+
def unpretty_ip(self, ip): # pylint: disable=no-self-use, invalid-name
269+
"""Converts a dotted-quad string to a bytearray IP address"""
270+
octets = [int(x) for x in ip.split('.')]
271+
return bytes(octets)
272+
268273
@property
269274
def mac_address(self):
270275
"""Returns the hardware's MAC address."""

0 commit comments

Comments
 (0)