Skip to content

Commit

Permalink
Merge pull request #21 from jimbobbennett/master
Browse files Browse the repository at this point in the history
Removed encoding parameter from bytes call for bytearray data
  • Loading branch information
FoamyGuy authored Mar 4, 2020
2 parents e8a7597 + 0450b6e commit c052e15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion adafruit_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ def request(method, url, data=None, json=None, headers=None, stream=False, timeo
sock.send(b"Content-Length: %d\r\n" % len(data))
sock.send(b"\r\n")
if data:
sock.send(bytes(data, "utf-8"))
if isinstance(data, bytearray):
sock.send(bytes(data))
else:
sock.send(bytes(data, "utf-8"))

line = sock.readline()
# print(line)
Expand Down

0 comments on commit c052e15

Please sign in to comment.