3.1.24 fetch
Usage:
include fetch
import fetch as ...
Fetches the content at the given url with HTTP GET, expecting that the result is text/plain.
If no errors occur, returns left with the returned string body. The user is expected to decompose this string using string or other functions.
If any errors occur, returns right with that error as a string.
Examples:
import fetch as F import either as Ei check: animals = F.fetch("https://raw.githubusercontent.com/brownplt/pyret-lang/refs/heads/horizon/tests/io-tests/tests/animals-ds-2024.csv") animals satisfies Ei.is-left string-contains(animals.v, "Name,Species,Sex,Age") is true bad-fetch = F.fetch("https://raw.githubusercontent.com/NO-SUCH-URL") bad-fetch satisfies Ei.is-right end