Skip to main content

neocitizen: Python client library for Neocities API

PyPI Version Python Versions License Code style: black Imports: isort

Neocities is a web hosting service for static pages. This is a library that makes the Neocities API available from the CLI and Python.

Installation

neocitizen is available on PyPI:

$ pip install neocitizen

You can also use poetry to add it to a Python project.

$ poetry add neocitizen

CLI Examples

Upload the directory and check the result

$ export NEOCITIES_API_KEY=<your api key here>
$ neocitizen upload --dir=/path/to/dir
$ neocitizen list
dir0
dir0/file00.html
dir0/file01.html
dir1
dir1/dir10
dir1/dir10/file100.html
dir1/dir11
dir1/dir11/file110.html
dir1/file10.html
dir1/file11.html
index.html

Download

$ export NEOCITIES_API_KEY=<your api key here>
$ neocitizen download /path/to/save

Detailed usage

$ neocitizen --help
Usage: neocitizen [OPTIONS] COMMAND [ARGS]...

Options:
  --version        Show the version and exit.
  --key TEXT       API key. You can also use the environment variable NEOCITIES_API_KEY instead.
  --username TEXT  User name for authentication. You can also use the environment variable NEOCITIES_USERNAME instead.
  --password TEXT  Password for authentication. You can also use the environment variable NEOCITIES_PASSWORD instead.
  -v, --verbose    Verbose output.
  --help           Show this message and exit.

Commands:
  delete    Delete the files on your Neocities site.
  download  Download all the files on your Neocities site.
  info      Show information about your Neocities site.
  key       Show API key.
  list      Show file list your Neocities site.
  upload    Upload local data to your Neocities site.

Python Examples

Code: example.py

from neocitizen import NeocitiesApi

api = NeocitiesApi()
response = api.fetch_info()
for key, value in response["info"].items():
    print(f"{key}: {value}")

Run

$ export NEOCITIES_API_KEY=<your api key here>
$ python example.py
sitename: neocli-test
views: 268
hits: 483
created_at: Sun, 05 Dec 2021 12:13:28 -0000
last_updated: Sun, 19 Dec 2021 13:37:13 -0000
domain: None
tags: []
latest_ipfs_hash: None

Metadata

Release files for neocitizen 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neocitizen 1.0.0
File Size Uploaded
neocitizen-1.0.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neocitizen 1.0.0
File Interpreter ABI Platform
neocitizen-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / neocitizen-1.0.0.tar.gz

Download URL neocitizen-1.0.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9be533ceed046dfe333c834287e872a6af7d2cfb3579bb339b939406e72f2b54
BLAKE2b-256 checksum
How to use checksums
ebf1f63949055daef578d048b51f89e95a472d9a2c5402388b5bbc8bfddcf9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.6.8 Linux/4.18.0-301.1.el8.x86_64

Release files / neocitizen-1.0.0-py3-none-any.whl

Download URL neocitizen-1.0.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d316c1f3b331d980733f650fe6c38af658a718e81e1fbfd343f8ed7e7ec7f855
BLAKE2b-256 checksum
How to use checksums
9a9345ede5e6c3beef7148f92a7d0955e9453a6ca20dc3a2da17abccf68be669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.6.8 Linux/4.18.0-301.1.el8.x86_64

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page