File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: MIT
33# Coded for Circuit Python 8.2.x
44"""OpenSky-Network.org Private Area API Example"""
5- # pylint: disable=import-error
65
76import binascii
87import os
4746# -- Base64 Conversion --
4847OSN_CREDENTIALS = str (osnusername ) + ":" + str (osnpassword )
4948# base64 encode and strip appended \n from bytearray
50- OSN_CREDENTIALS_B = binascii .b2a_base64 (b"" + str (OSN_CREDENTIALS )).strip ()
51- BASE64_STRING = str (OSN_CREDENTIALS_B ) # bytearray
52- SLICED_BASE64_STRING = BASE64_STRING [2 :- 1 ] # slice bytearray head/tail
49+ OSN_CREDENTIALS_B = binascii .b2a_base64 (OSN_CREDENTIALS .encode ()).strip ()
50+ BASE64_STRING = OSN_CREDENTIALS_B .decode () # bytearray
5351
5452if DEBUG :
5553 print ("Base64 ByteArray: " , BASE64_STRING )
56- print (f"Base64 Sliced String: { SLICED_BASE64_STRING } " )
5754
5855# Area requires OpenSky-Network.org username:password to be base64 encoded
59- OSN_HEADER = {"Authorization" : "Basic " + str ( SLICED_BASE64_STRING ) }
56+ OSN_HEADER = {"Authorization" : "Basic " + BASE64_STRING }
6057
6158# Example request of all traffic over Florida.
6259# Geographic areas calls cost less against the limit.
You can’t perform that action at this time.
0 commit comments