Skip to content

Circulars

A Circular holds a NASA GCN circular's text, publication details and metadata. You can load a circular from JSON or download it from the web, then find the other circulars it cites, the links it contains, and any email addresses or URL reported in its body.

tgcn.Circular

Data from a NASA GCN circular and methods to access it.

body

body: str

The full body text of the circular.

circularId

circularId: Annotated[StrictInt, Field(ge=0)]

The circular's GCN number.

createdOn

createdOn: StrictInt

Publication time in milliseconds since the Unix epoch.

date

date: datetime

Return the publication time as a UTC datetime.

Raises:

Type Description
OverflowError

The publication timestamp is outside the range of datetime.

eventId

eventId: str | None

Return the event ID as a string, or None if absent or null.

extras

extras: dict[str, Any]

A dictionary of the circular's optional metadata.

subject

subject: str

The circular's subject line.

submitter

submitter: str

The person or team who submitted the circular.

citations

citations() -> list[int]

Return unique cited GCN IDs from subject then body, in mention order.

emails

emails() -> list[str]

Return unique email addresses from subject then body, in mention order.

from_json

from_json(payload: bytes) -> Self

Parse a NASA GCN circular JSON.

Parameters:

Name Type Description Default
payload bytes

Raw JSON bytes for one GCN circular.

required

Returns:

Type Description
Self

The parsed circular with its source metadata.

Raises:

Type Description
ValidationError

The payload is invalid JSON or fails circular validation.

Examples:

Load a circular from a JSON file:

from pathlib import Path
from tgcn import Circular

circular = Circular.from_json(Path("circular.json").read_bytes())

from_web

from_web(circular_id: int, timeout: float = GCN_DOWNLOAD_TIMEOUT, *, version: int | None = None) -> Self

Download and parse a GCN circular revision.

Parameters:

Name Type Description Default
circular_id int

The GCN number of the circular to download.

required
timeout float

Timeout in seconds for blocking network operations.

GCN_DOWNLOAD_TIMEOUT
version int | None

Positive revision number. Use None for the latest revision or 1 for the original, including unedited circulars.

None

Returns:

Type Description
Self

The parsed circular with its source metadata.

Raises:

Type Description
OSError

The download fails or times out, including HTTP status errors reported by urllib such as 404 for a missing revision.

HTTPException

The HTTP response is malformed or incomplete.

ValidationError

The response is invalid JSON or fails circular validation.

ValueError

The version argument is invalid, or the response to a revision lookup identifies a different circular or archived revision.

urls

urls() -> list[str]

Return unique normalized URLs from subject then body, in mention order.