Skip to main content

A Python library for interacting with the WordPress REST API

Project description

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)

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

wordpress-1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

Wordpress-1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file wordpress-1.1.tar.gz.

File metadata

  • Download URL: wordpress-1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.5

File hashes

Hashes for wordpress-1.1.tar.gz
Algorithm Hash digest
SHA256 4609f53e75bbf78e21d041b41ba351641536435275db18e61dce992db240dad4
MD5 6b52346b45f9dc0b1c70f25e9f990ae9
BLAKE2b-256 e4d34df7278e45ecfbdccf97d3ce3c865007f7b21636e5990194ad6897292307

See more details on using hashes here.

File details

Details for the file Wordpress-1.1-py3-none-any.whl.

File metadata

  • Download URL: Wordpress-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.5

File hashes

Hashes for Wordpress-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b4792104b7df5cdd2fba35300092dfdf0a175844ce5c8c18664b762f9e16ba9
MD5 ab04d7992f7749eee6e1821a05419822
BLAKE2b-256 c710b44e9a829b05fb3cb898785e2d73c93592c2841a9bacff2d35004483d022

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