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.
pomdtr
auth_middleware
Script
Authentication middleware Guards your public http vals behind a login page. This val use a json web token stored as an http-only cookie to persist authentication. Usage Set an AUTH_SECRET_KEY env variable (used to sign/verify jwt tokens) to a random string . Then use an API token to authenticate. import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
async function handler(req: Request): Promise<Response> {
return new Response("You are authenticated!");
}
export default auth(handler); See @pomdtr/test_auth for an example ⚠️ Make sure to only provides your api token to vals you trust (i.e. your own), as it gives access to your whole account.
1
rozek
GDI_ClientInfoService
HTTP
This val is part of a series of examples to introduce "val.town" in my computer science course at
Stuttgart University of Applied Sciences . The idea is to motivate even first-semester students not to wait but to put their
ideas into practice from the very beginning and implement web apps with
frontend and backend. It contains a simple HTTP end point which accepts any kind of HTTP request and
responds with a JSON Structure containing some interesting details about the
client and its request. This val is the companion of https://rozek-gdi_clientinfo.web.val.run/ which contains the browser part (aka "frontend") for this example. The code was created using Townie - with only a few small manual corrections. This val is licensed under the MIT License.
0
stevekrouse
alive
Script
Human Alive-ness API It works by querying Wikidata via SPARQL to search for birth and death dates of a person. Requires an exact name match. It will throw if it can't find results. It will return true if every match has a birth date and not a death date. (It will return false if a match does not have a birth date, because we assume that to mean they are a historical figure whose birthdate we don't know.) @stevekrouse.alive("Henry Kissinger") // true (for now) You can view some example usages / tests here: https://www.val.town/v/stevekrouse.aliveTests
0
dthyresson
airportCodeMapRedirector
HTTP
IATA Airport Code Map Redirector I needed way redirect to a map for a given aiport given an IATA airport code . This way is it's a simple proxy redirect and I can change if I want to use Google Maps or another service (or change zoom levels, etc) without having to update the link. Usage: Boston Logan: https://iata.thyresson.io?q=bos
0
charmaine
googleGeminiAPI
Script
Gemini API A simple and easy to use client for the Gemini API This template shows you how to use the Gemini. This starter template was ported from this one on Docs . To run it: Click Fork on this val Get your Gemini API key Add it to your Environment Variables as GEMINI_API_KEY Click Run on this script val
0