- Posts: 4
- Thank you received: 1
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Example API HEADER: {'Authorization': 'Basic IFVTRVJOQU1FOlBBU1NXT1JEIA==\\n'}
Example API GET URL: OpenSky base URL/api/states/all?icao24=7c6b2d
osnu = "username"
osnp = "password"
transponder = "7c6b2d"
base_url = "insert opensky base url here"
osn_cred = str(osnu) + ":" + str(osnp)
bytes_to_encode = b" " + str(osn_cred) + " "
base64_string = (bytes_to_encode)
basepw = repr(base64_string)[2:-1]
osn_header = {"Authorization": "Basic " + str(basepw)}
OPENSKY_SOURCE = " (base_url)" + "icao24=" + transponder
opensky_response = requests(url=OPENSKY_SOURCE, headers=osn_header).json()
dump_object = (opensky_response)
print("JSON Dump: ", dump_object)
osn_flight = opensky_response["time"]
print("Current Unix Time: ", osn_flight)
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.