Skip to content

Commit

Permalink
Merge pull request #10 from brentru/unpretty-ip
Browse files Browse the repository at this point in the history
Add Unpretty_ip method
  • Loading branch information
brentru authored Mar 12, 2020
2 parents e41dccf + 892fa6d commit 5e74924
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions adafruit_wiznet5k/adafruit_wiznet5k.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ def pretty_ip(self, ip): # pylint: disable=no-self-use, invalid-name
"""
return "%d.%d.%d.%d" % (ip[0], ip[1], ip[2], ip[3])

def unpretty_ip(self, ip): # pylint: disable=no-self-use, invalid-name
"""Converts a dotted-quad string to a bytearray IP address"""
octets = [int(x) for x in ip.split('.')]
return bytes(octets)

@property
def mac_address(self):
"""Returns the hardware's MAC address."""
Expand Down

0 comments on commit 5e74924

Please sign in to comment.