Skip to main content

wordpress_poster

A modern Python library for posting content, uploading media, and interacting with the WordPress REST API. Supports any post type, media uploads, and is designed for easy integration and automation in your projects.

Features

  • Post creation for any post type (post, page, or custom types)
  • Media (image) upload
  • Environment variable-based configuration
  • Synchronous API
  • Raises exceptions on errors
  • Returns useful information (e.g., post URL, image URL)
  • Simple, Pythonic interface

Installation

For development (recommended):

pip install -e .

This will install the package in editable mode, so changes to the code are immediately reflected.

For users (from PyPI, if published):

pip install wordpress_poster

Environment Variables

The library requires the following environment variables to be set:

  • WP_URL — Your WordPress site URL (e.g., https://yourblog.com)
  • WP_USERNAME — Your WordPress username
  • WP_PASSWORD — Your WordPress application password (see WordPress Application Passwords)

You can set these in your shell, or use a .env file in your project root:

WP_URL=https://yourblog.com
WP_USERNAME=yourusername
WP_PASSWORD=yourapppassword

Basic Usage

Required Fields Only

from wordpress_poster.client import WordPressClient

wp = WordPressClient()

# Upload an image
success, image_url, image_id = wp.upload_image(
    'https://example.com/image.jpg',
    {'brand': 'Victor', 'name': 'Auraspeed'}
)

# Create a post (required fields only)
post_url = wp.create_post(
    post_type='post',
    title='My Title',
    content='<p>My content</p>'
)
print('Post created at:', post_url)

With Optional Fields

post_url = wp.create_post(
    post_type='post',
    title='My Title',
    content='<p>My content</p>',
    slug='my-title-slug',
    status='publish',
    categories=[2, 3],
    meta={'custom_field': 'value'},
    featured_media=image_id  # Set the featured image
)
print('Post created at:', post_url)

Running Tests

Install dev dependencies and run tests with:

pip install -r requirements.txt
pytest

Contributing

Pull requests and issues are welcome! Please open an issue if you find a bug or have a feature request.

License

MIT License. See LICENSE for details.

Metadata

Release files for wordpress-poster 0.1.1

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

Source distribution (sdist)

Source distribution for wordpress-poster 0.1.1
File Size Uploaded Provenance Actions
wordpress_poster-0.1.1.tar.gz 4.8 kB Without provenance Details for wordpress_poster-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wordpress-poster 0.1.1
File Interpreter ABI Platform Actions
wordpress_poster-0.1.1-py3-none-any.whl Python 3 none any Details for wordpress_poster-0.1.1-py3-none-any.whl

Total release size: 9.2 kB

Release files / wordpress_poster-0.1.1.tar.gz

Download URL wordpress_poster-0.1.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9041d3745a62d0a5ea2f40becd2c63e0e01d5326e3814a487ff1f205623ff6c8
BLAKE2b-256 checksum
How to use checksums
78ac004a83389534cff950acf76decace72ef79262cf280bee1658bfe81c7b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Release files / wordpress_poster-0.1.1-py3-none-any.whl

Download URL wordpress_poster-0.1.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f67cfeb8bcfdd8eb10a33c961eaba049effc130e3e2132cb332162ad077e4a3
BLAKE2b-256 checksum
How to use checksums
e9bdca88c56674d8dfbed4f04cf3b252a8215b6b22239e76991d930f2551b3f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Security for wordpress-poster 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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