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 4
4
"""OpenSky-Network.org Single Flight Private API Example"""
5
5
# pylint: disable=import-error
6
6
7
+ import binascii
7
8
import os
8
9
import time
9
10
10
11
import adafruit_connection_manager
11
12
import wifi
12
- from adafruit_binascii import b2a_base64
13
13
14
14
import adafruit_requests
15
15
43
43
44
44
# -- Base64 Conversion --
45
45
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
50
50
51
51
if DEBUG :
52
52
print ("Original Binary Data: " , OSN_CREDENTIALS_B )
53
- print ("Base64 ByteArray: " , BASE64_ASCII )
53
+ print ("Base64 ByteArray: " , BASE64_STRING )
54
54
print (f"Base64 String: { TRUNCATED_BASE64_STRING } " )
55
55
56
56
# 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