· 4 years ago · Mar 17, 2021, 09:16 AM
1# 9. Provide the URL to the ISS pass times API.
2 r = requests.get("http://api.open-notify.org/iss-pass.json?lat=LAT&lon=LON",
3 params = issAPIGetParameters
4 )
5
6 json_data = r.json()
7
8 if not "response" in json_data:
9 raise Exception("Incorrect reply from open-notify.org API. Status code: {}. Text: {}".format(r.status_code, r.text))
10
11# 10. Provide the ISS key values risetime and duration.
12 risetimeInEpochSeconds = json_data["<!!!REPLACEME!!!> with path to risetime key!!!>"]
13 durationInSeconds = json_data["<!!!REPLACEME!!!> with path to duration key!!!>"]
14
15# 11. Convert the risetime epoch value to a human readable date and time.
16 risetimeInFormattedString = <!!!REPLACEME with conversion code!!!>
17
18# 12. Complete the code to format the response message.
19# Example responseMessage result: In Austin, Texas the ISS will fly over on Thu Jun 18 18:42:36 2020 for 242 seconds.
20 responseMessage = "In {} the ISS will fly over on {} for {} seconds.".format(<!!!REPLACEME with required variables!!!>)
21
22 print("Sending to Webex Teams: " +responseMessage)