loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests

# Parameters taken from QF 64 from Johannesburg to Sydney
params = {
  "origin" : "JNB", # can be ICAO or iATA codes
  "destination" : "SYD",
  "altitude" : 8.85, # km,
  "duration" : 12, # hours
  "year" : 2020,
  "month" : 1,
  "day" : 10
}

# Make the API call
try:
  response = requests.get("https://cosmicrays.amentum.space/route/effective_dose",
    params=params)
  response_json = response.json()
  response.raise_for_status()
except requests.exceptions.HTTPError as e:
  print(response_json['error'])
else:
  # Extract the dose
  effective_dose = response_json['dose']['value']
  print(f"Total route dose for flight QF64 was {effective_dose:.2f} uSv")

Fetching token