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
http_client
HTTP
HTTP Client Attach a postman-like http client to your vals, with bookmarks and history support Usage Wrap your http handler in an the httpClient middleware. import {httpClient} from "https://esm.town/v/pomdtr/http_client"
export default httpClient((req) => {
return new Response("Hello World!")
}) The http client will be shown on the root. Adding bookmarks You might want to bookmark some requests you need often. You can do it by passing a bookmark list as a middleware option: import {httpClient} from "https://esm.town/v/pomdtr/http_client"
export default httpClient((req) => {
return new Response("Hello World!")
}, {
bookmarks: [
{
"label": "Dummy Request",
"request": new Request("https://dummyjson.com/products")
}
]}) Customizing the client path import {httpClient} from "https://esm.town/v/pomdtr/http_client"
export default httpClient((req) => {
return new Response("Hello World!")
}, {
path: "/http-client"
}) TODO [ ] fix syntax highlighting on successive request [ ] allow to prefill the initial request
7
singpolyma
sendxmpplib
Script
Simple helper for sending a message over XMPP. For an API that doesn't require your own bot setup see https://www.val.town/v/singpolyma/sendxmpp import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib";
await sendxmpp("someone@example.com", "Hello!"); Also supports optional keepalive to send multiple messages with one connection: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib";
await sendxmpp("someone@example.com", "1", true);
await sendxmpp("someone@example.com", "2", true);
await sendxmpp("someone@example.com", "3); Or even manual disconnect: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib";
await sendxmpp("someone@example.com", "1", true);
await sendxmpp("someone@example.com", "2", true);
const stop = sendxmpp("someone@example.com", "3", true);
stop(); Environment variables needed for your bot: XMPP_URI=wss://example.com
XMPP_DOMAIN=example.com
XMPP_USERNAME=bot
XMPP_PASSWORD=password Only websockets or direct tls (xmpps://) connections are supported until https://github.com/denoland/deno/issues/26685 is fixed
0
ChaitanMajhi9006
clearSilverMarten
Script
import pytesseract
from pytesseract import Output
from PIL import Image
import cv2
import os Tesseract का पथ (सुनिश्चित करें कि Tesseract इंस्टॉल हो) pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' इमेज प्रोसेसिंग के लिए फंक्शन def process_image(image_path, output_format="txt"):
try:
# इमेज को लोड करें और प्रोसेस करें
image = cv2.imread(image_path)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # नॉइज़ रिमूवल
processed_image = cv2.GaussianBlur(gray, (5, 5), 0)
# OCR से टेक्स्ट पहचान
text_data = pytesseract.image_to_string(processed_image, lang="eng+hin+ben", config='--psm 6')
# टेक्स्ट फॉर्मेट करना
print("\nExtracted Text:\n", text_data)
# आउटपुट फॉर्मेट के अनुसार फाइल सेव करना
if output_format == "txt":
with open("output_text.txt", "w", encoding="utf-8") as file:
file.write(text_data)
print("Text saved as 'output_text.txt'.")
elif output_format == "pdf":
pdf_output = pytesseract.image_to_pdf_or_hocr(processed_image, extension='pdf')
with open("output_document.pdf", "wb") as file:
file.write(pdf_output)
print("PDF saved as 'output_document.pdf'.")
except Exception as e:
print("Error:", e) इमेज का पथ image_path = "sample_image.jpg" # अपनी इमेज का पथ दें
output_format = "pdf" # 'txt' या 'pdf' में से चुनें फंक्शन को कॉल करें process_image(image_path, output_format)
0