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 2
2
# SPDX-License-Identifier: MIT
3
3
# Coded for Circuit Python 8.2.x
4
4
"""OpenSky-Network.org Private Area API Example"""
5
- # pylint: disable=import-error
6
5
7
6
import binascii
8
7
import os
47
46
# -- Base64 Conversion --
48
47
OSN_CREDENTIALS = str (osnusername ) + ":" + str (osnpassword )
49
48
# 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
53
51
54
52
if DEBUG :
55
53
print ("Base64 ByteArray: " , BASE64_STRING )
56
- print (f"Base64 Sliced String: { SLICED_BASE64_STRING } " )
57
54
58
55
# 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 }
60
57
61
58
# Example request of all traffic over Florida.
62
59
# Geographic areas calls cost less against the limit.
You can’t perform that action at this time.
0 commit comments