FileUrlExpiredError Class

Raised when an inbound file's short-lived download URL has expired and can no longer fetch bytes.

A personal file's pre-authorized tempauth download URL is valid only briefly. A fetch after it lapses gets a 401/403 from the platform. A handler that downloads once (and does not keep the handle) should not hit this. reason distinguishes the two cases:

  • first_fetch: the first fetch came after the URL lapsed, so no bytes were retrieved. There is no recovery: the

    URL carried its own credential, and the SDK does not fall back to Graph with an app identity. The file has to be sent again.

  • reread: edge case. An earlier download succeeded, then a later re-fetch through the same handle lapsed. Avoid it by calling download() once and reusing the returned DownloadedFile rather than re-reading the handle.

Constructor

FileUrlExpiredError(reason: Literal['first_fetch', 'reread'], message: str | None = None)

Parameters

Name Description
reason
Required
message
Default value: None

Attributes

reason

Lets callers branch without string-matching the message. first_fetch: no bytes were ever fetched. reread: the uncommon case, a previously successful handle re-fetched too late.

reason: Literal['first_fetch', 'reread']