12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export async function exchangeRate() {
5 const cheerio = await import("npm:cheerio");
6 const page = await fetch(
7 "https://kur.doviz.com/serbest-piyasa/amerikan-dolari",
8 ).then((response) => response.text());
10 let status: number;
11 try {
12 const res = await fetch(URL, { redirect: "follow" });
13 if (res.status !== 200) {
14 reason = `(status code: ${res.status})`;
17 }
18 } catch (e) {
19 reason = `couldn't fetch: ${e}`;
20 ok = false;
21 }
61 attachments?: AttachmentData[];
62}) => {
63 let result = await fetch(
64 `${API_URL}/v1/email`,
65 {
1import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
4import { Readability } from "npm:@mozilla/readability";
89 }
90
91 let body = await fetchText(articleUrl);
92
93 let doc = new JSDOM(body);
1Migrated from folder: a0_forks/fetchText
1Migrated from folder: a0_forks/fetchJSON
14export async function getCertificates(domain: string) {
15 const url = `https://crt.sh/json?q=${domain}`;
16 const response = await fetch(url);
17 const certificates: Certificate[] = await response.json();
18 const domains = [...new Set(certificates.map(el => el.common_name))];
1Migrated from folder: a2_shared/fetch_example
1# Proxied fetch - https://docs.val.town/std/fetch
2
3Migrated from folder: a0_forks/fetch