TNS API
The TNS API provides a simple client interface to interact with the TNS service.
Quick Start¶
After authenticating, you can use the TNS API as follows:
Sandbox Usage
When sandbox=True, requests go to the TNS sandbox site. This is a safe testing
environment and does not affect real TNS records. When sandbox=False,
requests target the live TNS service. Be cautious when using this mode.
from chime_frb_api.backends.frb_master import FRBMaster
master = FRBMaster()
# 1) Submit an event to TNS
submit_resp = master.tns.submit(event_number=65628049, period=5, sandbox=False)
# 2) Search for the TNS name by event number
search_resp = master.tns.search(event_number=65628049, sandbox=False)
# 3) Change proprietary period for an existing TNS object
change_resp = master.tns.change(
tns_name="FRB20191220F",
end_prop_period_date="2030-01-01",
sandbox=False,
)
Error Handling¶
All methods return the server response on success. On HTTP errors, the client
returns a dictionary with success: false, a status_code, and any JSON error
payload returned by the server.
API Reference¶
Bases: API
CHIME/FRB TNS API.
Submit CHIME/FRB data to the Transient Name Server (TNS) for acquiring official TNS object names for CHIME/FRB events, and for searching the official TNS object name of an inputted CHIME/FRB event number.
change
¶
Change TNS proprietary period end date for an FRB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tns_name
|
str
|
TNS object name (e.g., FRBYYYYMMDDX). |
required |
end_prop_period_date
|
str
|
New end date (YYYY-MM-DD). |
required |
sandbox
|
bool
|
If True, target sandbox TNS. If False, target live TNS. |
True
|
Returns: Dict response from the server.
search
¶
Search TNS for a CHIME/FRB event by internal name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_number
|
int
|
Internal CHIME/FRB event number. |
required |
sandbox
|
bool
|
If True, search sandbox TNS. If False, search live TNS. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict response from the server. |
submit
¶
Submit CHIME/FRB event to TNS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_number
|
int
|
CHIME/FRB event number. |
required |
period
|
int
|
Proprietary period in years. |
required |
sandbox
|
bool
|
If True, submit to sandbox TNS. If False, submit to live TNS. |
True
|
force
|
bool
|
If True, submit even if a TNS name already exists. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict response from the server. |