File tree Expand file tree Collapse file tree 2 files changed +6
-126
lines changed Expand file tree Collapse file tree 2 files changed +6
-126
lines changed Original file line number Diff line number Diff line change 44"""OpenSky-Network.org Single Flight Private API Example"""
55# pylint: disable=import-error
66
7+ import binascii
78import os
89import time
910
1011import adafruit_connection_manager
1112import wifi
12- from adafruit_binascii import b2a_base64
1313
1414import adafruit_requests
1515
4343
4444# -- Base64 Conversion --
4545OSN_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
5151if 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
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments