3.1 General-Purpose Libraries
3.1.1 Global Utilities
3.1.2 Numbers
3.1.3 Strings
3.1.4 Booleans
3.1.5 option
3.1.6 either
3.1.7 pick
3.1.8 lists
3.1.9 sets
3.1.10 arrays
3.1.11 string-dict
3.1.12 Tables
3.1.13 gdrive-sheets
3.1.14 csv
3.1.15 color
3.1.16 The image libraries
3.1.17 reactors
3.1.18 chart
3.1.19 plot
3.1.20 statistics
3.1.21 math
3.1.22 matrices
3.1.23 Timing
3.1.24 fetch
On this page:
fetch
3.1.24 fetch🔗

Usage:
include fetch
import fetch as ...

fetch :: (
url :: String
)
-> Either<String, String>

Fetches the content at the given url with HTTP GET, expecting that the result is text/plain. If any errors occur, returns right with that error. If no errors occur, returns left with the returned string body.

Examples:

include fetch check: animals-data = fetch("https://raw.githubusercontent.com/brownplt/pyret-lang/refs/heads/horizon/tests/io-tests/tests/animals-ds-2024.csv") spy: animals-data end string-contains(animals-data.v, "Name,Species,Sex,Age (years)") is true end