Skip to main content

Python client library for Neocities API

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neocitizen-1.0.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

neocitizen-1.0.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file neocitizen-1.0.0.tar.gz.

File metadata

  • Download URL: neocitizen-1.0.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.6.8 Linux/4.18.0-301.1.el8.x86_64

File hashes

Hashes for neocitizen-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9be533ceed046dfe333c834287e872a6af7d2cfb3579bb339b939406e72f2b54
MD5 f92469dfeb0baf60adf18e7aa7653963
BLAKE2b-256 ebf1f63949055daef578d048b51f89e95a472d9a2c5402388b5bbc8bfddcf9da

See more details on using hashes here.

File details

Details for the file neocitizen-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: neocitizen-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.6.8 Linux/4.18.0-301.1.el8.x86_64

File hashes

Hashes for neocitizen-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d316c1f3b331d980733f650fe6c38af658a718e81e1fbfd343f8ed7e7ec7f855
MD5 f389f0402316cd56acd3ed41621a2335
BLAKE2b-256 9a9345ede5e6c3beef7148f92a7d0955e9453a6ca20dc3a2da17abccf68be669

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page