Skip to content

Commit d55203a

Browse files
committed
update with requested changes
1 parent 5f04a60 commit d55203a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/wifi/expanded/requests_wifi_api_openskynetwork_private_area.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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

76
import binascii
87
import os
@@ -47,16 +46,14 @@
4746
# -- Base64 Conversion --
4847
OSN_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

5452
if 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.

0 commit comments

Comments
 (0)