1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function latestBlogContent() {
4 return (
5 await fetch(
6 "https://datasette.simonwillison.net/simonwillisonblog.json?_shape=array&sql=select+%27entry%27+as+type%2C+title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fe%2F%27+%7C%7C+id+as+url+from+blog_entry%0D%0Aunion+all%0D%0Aselect+%27blogmark%27+as+type%2C+link_title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fb%2F%27+%7C%7C+id+from+blog_blogmark%0D%0Aunion+all%0D%0Aselect+%27quotation%27+as+type%2C+source%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fq%2F%27+%7C%7C+id+from+blog_quotation%0D%0Aorder+by+created+desc"
7 )
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, filename = "data.json", purpose = "assistants" }: {
17 formData.append("purpose", purpose);
18 formData.append("file", file, filename);
19 let result = await fetch("https://api.openai.com/v1/files", {
20 method: "POST",
21 headers: {
5Either use the provided UI, or the query param:
6
7<https://val-town-search.pomdtr.me/search?q=fetchJSON>
8
9## How does it work ?
16
17// The lower level set and get can be used to store non-JSON or binary data.
18const resp = await fetch("https://picsum.photos/600/300");
19await blob.set("image", resp.body);
20const image = await blob.get("image");
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 const SAMPLE_JOKE = {
6 "setup": "What do you call a group of disorganized cats?",
10}
11
12const randomJoke = fetchRandomJoke();
13const setup = randomJoke.setup;
14const punchline = randomJoke.punchline;
1import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
2
3const url = "https://atmos.washington.edu/cgi-bin/uw.cgi?20240408";
4const data = await insecureFetch(url);
5const text = await data.text();
6console.log(text);
1This is an example call of @stevekrouse/insecureFetch
1import { fetch } from "https://esm.town/v/std/fetch?v=5";
2
3const url = "https://atmos.washington.edu/cgi-bin/uw.cgi?20240408";
4const data = await fetch(url);
5const text = await data.text();
6console.log(text);
1This is an example call of @stevekrouse/insecureFetch
2
3Migrated from folder: Archive/blueSwordfish
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export default async () => {
8 let reason: string;
9 try {
10 const res = await fetch(URL);
11 if (res.status !== 200) {
12 reason = `(status code: ${res.status})`;
14 }
15 } catch (e) {
16 reason = `couldn't fetch: ${e}`;
17 ok = false;
18 }