Sources indicate that tcl is still everywhere: build systems, EDA tools, test rigs, embedded boxes. It also makes a nice little HTTP + JSON client. In this tutorial we build bios.tcl, a terminal reader for two APIs from QuraniAPI:.
Tested with Tcl 8.6.16, tcllib 2.0 (json 1.3.6) and tcl-tls 1.8.0 on Debian.
Tcl ships http, but HTTPS needs tls and JSON parsing needs tcllib:.
lang can be all or a single language code. CORS is open and the response is plain JSON. A trimmed Sahaba response:. (Related: How to train a new language model from scratch using Tr...)
Ambiya items look the same, except each translation has a title and a story, and there is an order field:. (Related: Tech Report: Porting fairseq wmt19 translation system t...)
The public response is a sample (5 prophets and 5 companions). Our code only reads items, so it works the same with the full dataset.
All the logic lives in a small namespace so we can test it. Three details matter:.
bios::card turns both datasets into one shape (kind id name name_ar title text), so the rest of the code doesn't care whether it is showing a prophet or a companion.
If the network is down and the cache is older than 24 hours, you still get data plus a warning on stderr:.
Sources indicate that tcltest comes with Tcl. The tests use small inline fixtures, so they run offline:.
