Skip to main content

Wordpress Python Library

The wordpress Python library provides a simple interface to interact with the WordPress REST API. It allows you to manage various aspects of your WordPress site, including pages, posts, categories, media, users, and comments.

Download stats

Downloads

Features

  • Fetch, create, update, and delete pages
  • Fetch, create, update, and delete posts
  • Fetch, create, update, and delete categories
  • Upload and manage media
  • Fetch and manage users
  • Fetch and manage comments

Installation

You can install the library using pip:

pip install wordpress

Usage

Importing the Library

import wordpress

Connecting to WordPress

To use the library, create an instance of the wordpress.Connect class by providing the base URL of your WordPress site and authentication details (username and password).

site_url = "https://yourwordpresssite.com"
username = "yourusername"
password = "your_application_password" #read documentation https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/
wp = wordpress.Connect(site_url, username, password)

Pages

Fetch All Pages

wp.page.fetch_all_pages()

Create a New Page

wp.page.create_page(title="About Us", content="This is the About Us page.")

Fetch a Specific Page

wp.page.fetch_page(page_id=123)

Delete a Page

wp.page.delete_page(page_id=123)

Posts

Fetch All Posts

wp.post.fetch_all_posts()

Create a New Post

wp.post.create_post(title="New Blog Post", content="This is a new blog post.")

Fetch a Specific Post

wp.post.fetch_post(post_id=123)

Delete a Post

wp.post.delete_post(post_id=123)

Categories

Fetch All Categories

wp.category.fetch_all_categories()

Create a New Category

wp.category.create_category(name="New Category")

Fetch a Specific Category

wp.category.fetch_category(category_id=123)

Delete a Category

wp.category.delete_category(category_id=123)

Media

Upload Media

wp.media.upload_media(file_path="path/to/your/image.jpg")

Fetch All Media

wp.media.fetch_all_media()

Fetch a Specific Media Item

wp.media.fetch_media(media_id=123)

Delete Media

wp.media.delete_media(media_id=123)

Users

Fetch All Users

wp.user.fetch_all_users()

Fetch a Specific User

wp.user.fetch_user(user_id=123)

Comments

Fetch All Comments

wp.comment.fetch_all_comments()

Fetch a Specific Comment

wp.comment.fetch_comment(comment_id=123)

Release files for Wordpress 1.2

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 1.2
File Size Uploaded
wordpress-1.2.tar.gz 6.0 kB Details

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / wordpress-1.2.tar.gz

Download URL wordpress-1.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fb61df0a435905aaa83b56ca7800f3a367fb59d01730a5d1f0d383ea7cca27fd
BLAKE2b-256 checksum
How to use checksums
c457e615f7afec4bcf5c56aa577bc0557419a08478591a763c141f745428c1db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.8

Release files / Wordpress-1.2-py3-none-any.whl

Download URL Wordpress-1.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
113dc22028eb6e08548766936d60015b23301dbd7ac5f525c2fb07ef161b218a
BLAKE2b-256 checksum
How to use checksums
6eaa0639fc805f587e195121c0322248272239c1a8be9ad9b1e029f7d78d07fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1

2 release files

0.0.1

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