Skip to main content

WordPress APIを活用して記事を投稿・管理するCLIツール

Project description

wpctl

WordPress APIを活用して、記事を投稿・管理するCLIツール。

概要

MarkDown / テキスト / HTMLファイルを読み込み、WordPress REST APIを通じて記事の投稿・更新を行います。

機能

機能 コマンド 説明
記事投稿 wpctl post create Markdownなどのファイルを記事として投稿する
記事更新 wpctl post update 既存の記事をファイルの内容で更新する

インストール

pip install wpctl

使い方

記事を投稿する

wpctl post create [-t "記事のタイトル"] <FilePath>
引数 オプション 必須 説明
FilePath true 投稿するファイルのパス
title --title, -t 記事タイトル(デフォルト: タイトル未設定

記事を更新する

wpctl post update --id <ID> [-t "記事のタイトル"] <FilePath>
引数 オプション 必須 説明
FilePath true 投稿するファイルのパス
id --id true 更新対象の記事ID
title --title, -t 記事タイトル(デフォルト: タイトル未設定

環境変数

環境変数 必須 説明
WP_USER true WordPressのユーザー名
WP_APP_PASSWORD true WordPressのアプリパスワード
WP_SITE_URL true WordPressのサイトURL

.env ファイルは非対応です。あらかじめシェルの環境変数に設定してください。

対応ファイル形式

  • .txt
  • .md
  • .html

Dev

ツールを読み込んで実行する場合

pip install -e .
wpctl post create article.md

Tool

Test

pip install -r requirements-dev.txt
pytest tests/
# ログを出力する場合
# pytest -s tests/

Lint

pip install -r requirements-dev.txt
ruff check .
# 自動修正する場合
ruff check . --fix

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

wpctl-1.0.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wpctl-1.0.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file wpctl-1.0.1.tar.gz.

File metadata

  • Download URL: wpctl-1.0.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wpctl-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c1e6b96f069f4f0cf162006ac65566af6e65eec1b9265110738384d934d83d24
MD5 9632cd64c5e366664fd78e5987dfb248
BLAKE2b-256 64dd0d840cd289cf3e4580953592c2a4c9f76ebd438f0dc0eef76aa87006d34b

See more details on using hashes here.

File details

Details for the file wpctl-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: wpctl-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wpctl-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d409e640035e410d216a62ddeebd24c0187d146990e6dc6cc15ab848384e7a76
MD5 dc508d401aa8f2f509bd9efb3651a1cc
BLAKE2b-256 bf795fb0a250f753aa71f2f1eb20faf549f72768f37d09cd76534de5ae28bfbb

See more details on using hashes here.

Supported by

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