US Congress Stock Trading API examples & templates
Use these vals as a playground to view and fork US Congress Stock Trading API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
simplescraper
aiEmailAssistant
Email
Email AI Assistant Chat with your favorite AI via email (with PDF attachment support) What It Does This script allows you to: Send emails to OpenAI. The text will be treated as the prompt Parse PDF attachments and include their contents in the AI's analysis. Get response directly to your inbox. Setup guide Copy this Val and save it as an Email Val (choose Val type in top-right corner of editor) Add your OpenAI API key to line 8 (or use an environment variable: https://docs.val.town/reference/environment-variables/) Copy the email address of the Val (click 3 dots in top-right > Copy > Copy email address) Write your email, include any attachments, and send it to the Val email address. The AI will respond after a few seconds.
0
neverstew
finalUrl
HTTP
Final URL I keep getting tracking links as part of emails. They suck! Use Val Town as a tracking shield - call this val and get redirected to the final URL at the end of the redirection chain without picking up trackers along the way. https://neverstew-finalurl.web.val.run/<tracking_link> Example The Glastonbury registration lookup link. https://neverstew-finalurl.web.val.run/https://scke65qh.r.eu-west-1.awstrack.me/L0/https:%2F%2Fglastonbury.seetickets.com%2Fregistration%2Flookup/2/01020189fe6dd832-f894deea-eab7-4d1d-8c6a-0818e87ac95c-000000/8f6rVLcCc3v6CQNroYC81q9YkaU=335
0
jdan
honoBasicAuthMiddleware
Script
honoBasicAuthMiddleware You should use https://hono.dev/middleware/builtin/basic-auth instead. Used to authenticate your HTTP vals build with Hono behind a username/password challenge. Browsers store this information alongside your other passwords. Usage In basicAuthButton , I secure two routes (one for viewing a value, one for updating it) behind a username/password combo stores in my Env variables. /** @jsxImportSource npm:hono@3/jsx */
import { honoBasicAuthMiddleware } from "https://esm.town/v/jdan/honoBasicAuthMiddleware";
import { blob } from "https://esm.town/v/std/blob?v=12";
import { Hono } from "npm:hono";
/** Authenticate the URL */
const secretUsername = Deno.env.get("BUTTON_USERNAME");
const secretPassword = Deno.env.get("BUTTON_PASSWORD");
app.use(honoBasicAuthMiddleware(secretUsername, secretPassword));
app.get("/", async (c) => {
const lastPressed = await blob.getJSON(blobStorageKey) || "Never";
return c.html(
<div>
<h1>Last Pressed: {lastPressed}</h1>
<form method="POST" action="/press">
<input type="submit" />
</form>
</div>,
);
});
0
jollytoad
helloWorld
HTTP
Hello world server, using http functions . Try hitting URLs such as: /world , /world.txt , /world.json , /world.html , or even /<script>.html . This demonstrates how you can import and compose simple functions to construct a router to route based on various aspects of a request, ie. the URL path, method, and even on media-types based on path extension or the Accept header. See routing functions , and response helpers on JSR. For a more detailed guide on building a Deno app, including things like fs based routing, with these fns see... https://jollytoad.deno.dev/blog/http_getting_started
0