api.hosts

get()

api.hosts.get(id) → Promise<Host>

Un host, con su despliegue actual, sus dominios y su estado de certificado — releer desde la plataforma.

GETfreere-reads the certificate
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const host = await api.hosts.get(id);

host.current;      // the deploy currently online
host.certificate;  // "none" | "pending" | "active"
host.domains_;     // the customer domains attached
host = api.hosts.get(host_id)

host.current       # the deploy currently online
host.certificate   # "none" | "pending" | "active"
host.domains_      # the customer domains attached

Así es como se sigue un certificado pendiente

let host = await api.hosts.get(id);

while (host.certificate === "pending") {
  await new Promise((r) => setTimeout(r, 10_000));
  host = await api.hosts.get(id);
}
import time

host = api.hosts.get(host_id)

while host.certificate == "pending":
    time.sleep(10)
    host = api.hosts.get(host_id)

Nada te notifica. El estado se relee cuando se lee un host, que es lo que hace que una encuesta corta sea la forma correcta después de un despliegue en un nivel de dirección fresco.

corriente es lo que está en línea

El despliegue que responde ahora — que no es siempre el más reciente, después de un reversión. deployments() es la historia.

Los dominios adjuntos vienen con él

domains.list() lee lo mismo con una petición propia, que es útil después de adjuntar uno.

Errores

Un identificador desconocido responde 404 — incluyendo uno que pertenece a otra cuenta, que es la misma respuesta a propósito.