Web · real, tested code

Make an HTTP GET Request in Larzscript

Fetch a URL and read its status code and body - or parse a JSON API response directly.

http is a curl-based client (get/post/status/download/get_json/post_json), the same package a real Larzscript CLI app uses to talk to any HTTP API.

larzscript pkg install http
larzscript pkg install json

Code

import "http" as http

print(http.status("https://example.com"))
let body = http.get("https://example.com")
print(len(body), "bytes")
Output
200
559 bytes