Neocities.org

VE3ZSH - Keller

ve3zsh.neocities.org

244,903 views
31 followers
3,086 updates
0 tips
Bit of a fun experimental piece of tech. https://ve3zsh.neocities.org/advice/index.html should automatically update every day with a new quote and hero image without relying on JavaScript.
lsuzkxbziosbd 2 years ago

how could I implement this in my site? I have been looking for something like this for a while and I want to learn how to put it in mine. :)

ve3zsh 2 years ago

I did it with a bit of Python running on my computer. You can use the Neocities API to upload files (https://neocities.org/api). So, I wrote a script that picks a random quote and image and uploads them to the site every day at midnight. Then scheduled it (I used systemd's timers, but you could do it on Windows or Mac also (https://www.isunshare.com/windows-10/4-ways-to-open-task-scheduler-on-windows-10.html)).

ve3zsh 2 years ago

Essential Python code: requests.post("https://neocities.org/api/upload", headers={"Authorization": "Bearer YOUR_API_KEY_HERE", "User-Agent": "neocron/0.1"}, files={"path/to/put/image.jpg": open(file="C:\path\to\get\image.jpg", mode="rb"))

Website Stats

Last updated 14 hours ago
CreatedMay 16, 2021
Site Traffic Stats

Tags

programming hamradio personal aphorisms