Neocities.org

VE3ZSH - Keller

ve3zsh.neocities.org

268,007 views
41 followers
4,115 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 3 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 3 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 3 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"))

Cool stuff!
1 like
ve3zsh 3 years ago

Thanks. :)

1 like

Website Stats

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

Tags

personal aphorisms programming hamradio