___  ____  ____   ___  __
 / __)(  __)/ ___) / __)/  \
( (__  ) _) \___ \( (__(  O )
 \___)(____)(____/ \___)\__/

I wrote a Python script to upload articles to smol.pub

I was bored, so I wrote a Python script to upload my articles to smol.pub, just like the "smolpub.sh" bash script.

It's still a work in progress, but so far, it works for posting new articles and updating existing ones. In fact, I posted this announcement using my script.

Installation

The easiest way to install it on your computer is to use the "pipx" package manager by entering this command on your terminal:

pipx install smolpub

The script requires at least Python 3.10 or higher, and just like "smolpub.sh", it requires that you have a copy of your personal token string written in a file called ".smolpub" on a subfolder inside your home directory:

~/.config/

Usage

Once the script is installed on your computer, you can invoke it by entering this command in the terminal:

smolpub <file to post>

Where "<file to post>" must be a text file formatted in UTF-8 in GemText format. I recommend you use the ".gmi" extension and follow the formatting instructions that you'll find on this page:

Smol.pub Manual

Launching the script for the first time

The very first time, the script will ask you to provide a valid API Token for accessing smol.pub. If you don't know how to fetch one yet, please visit:

http://smol.pub/settings

And copy the API Token and paste it into your terminal, then press ENTER. The script will create a config file for you and will make it accessible only by your actual username.

And that's how the script works, more or less

If you like it, try it and tell me if it works!

Also, look at this page on GitHub, where you will find further documentation about the script and the full source code:

Source code on github.com

Cheers!

_-_-_-_-_-_

Thanks for reading!

If you want to get in touch with me, you can use one of the following links:

Mastodon
GitHub
Email

Otherwise..

Go back to the main page

© 2024 Francesco Maida. You are free to distribute the content posted here, as long as you mention me and my website or gemini capsule. Hosted by smol.pub