loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import json
import requests

hostname = "https://globalmagnet.amentum.space/api/calculate_magnetic_field"

payload = dict(
    altitude = 10, # [km]
    longitude = 100, # [deg]
    latitude = 45, 
    year = 2015.5 # decimal year, half-way through 2015
)

try: 
  response = requests.get(hostname, params=payload)
except requests.exceptions.RequestException as e:
  print(e.args)

json_payload = response.json()
print(json.dumps(json_payload, indent=4, sort_keys=True))