
Fetch a TSV from the BLS flat file database over HTTP with an email User-Agent and parse it
Source:R/get_bls_data.R
get_bls_data.Rd
Validates bls_url
and email
as string scalars, verifies the email format,
sends a GET request using httr2 with the email in the User-Agent header
and a request timeout, and on a successful response with Content-Type: text/plain
or text/tab-separated-values
and a non-empty body, parses the payload as TSV
via readr and returns a tibble.
Details
Email validation uses a practical regex rather than full RFC 5322.
HTTP errors (non-2xx) raise an error with status, reason, URL, response headers, and a short body snippet (best-effort).
If the response is successful but not
text/plain
ortext/tab-separated-values
, or the body is empty, an error is raised (with headers included).