Skip to content

Commit 0e65d91

Browse files
committed
remove adafruit_binascii replace with built-in binascii
1 parent b42f593 commit 0e65d91

File tree

2 files changed

+6
-126
lines changed

2 files changed

+6
-126
lines changed

examples/wifi/expanded/requests_wifi_api_openskynetwork_private.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"""OpenSky-Network.org Single Flight Private API Example"""
55
# pylint: disable=import-error
66

7+
import binascii
78
import os
89
import time
910

1011
import adafruit_connection_manager
1112
import wifi
12-
from adafruit_binascii import b2a_base64
1313

1414
import adafruit_requests
1515

@@ -43,14 +43,14 @@
4343

4444
# -- Base64 Conversion --
4545
OSN_CREDENTIALS = str(osnusername) + ":" + str(osnpassword)
46-
OSN_CREDENTIALS_B = b"" + str(OSN_CREDENTIALS) + ""
47-
BASE64_ASCII = b2a_base64(OSN_CREDENTIALS_B)
48-
BASE64_STRING = str(BASE64_ASCII) # bytearray
49-
TRUNCATED_BASE64_STRING = BASE64_STRING[2:-3] # truncate bytearray head/tail
46+
# base64 encode and strip appended \n from bytearray
47+
OSN_CREDENTIALS_B = binascii.b2a_base64(b"" + str(OSN_CREDENTIALS)).strip()
48+
BASE64_STRING = str(OSN_CREDENTIALS_B) # bytearray
49+
TRUNCATED_BASE64_STRING = BASE64_STRING[2:-1] # truncate bytearray head/tail
5050

5151
if DEBUG:
5252
print("Original Binary Data: ", OSN_CREDENTIALS_B)
53-
print("Base64 ByteArray: ", BASE64_ASCII)
53+
print("Base64 ByteArray: ", BASE64_STRING)
5454
print(f"Base64 String: {TRUNCATED_BASE64_STRING}")
5555

5656
# Requests URL - icao24 is their endpoint required for a transponder

examples/wifi/expanded/requests_wifi_api_twitter.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)