/
delete_source.py
36 lines (29 loc) · 1.16 KB
/
delete_source.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
28
29
30
31
32
33
34
35
36
import pyaurorax
import os
def main():
# read API key from environment vars
api_key = os.environ["AURORAX_API_KEY"]
pyaurorax.api.set_base_url("https://api.staging.aurorax.space")
pyaurorax.authenticate(api_key)
# set values
program = "test-program"
platform = "test-platform"
instrument_type = "test-instrument"
# get source record to pull out the identifier
sources = pyaurorax.sources.get_using_filters(program=program,
platform=platform,
instrument_type=instrument_type)
if (len(sources) == 0):
sources = pyaurorax.sources.get_using_filters(program=program,
platform=platform,
instrument_type="test-instrument-updated")
if (len(sources) == 0):
print("No data source found")
return
identifier = sources[0].identifier
# remove source
pyaurorax.sources.delete(identifier)
print("Successfully removed data source")
# ----------
if (__name__ == "__main__"):
main()