Methods

See Examples for guidance on how to use the following method classes.

methods.posts

class wordpress_xmlrpc.methods.posts.GetPosts([filter, fields])

Retrieve posts from the blog.

Parameters:
filter: optional dict of filters:
  • number
  • offset
  • orderby
  • order: ‘ASC’ or ‘DESC’
  • post_type: Defaults to ‘post’
  • post_status

Returns: list of WordPressPost instances.

class wordpress_xmlrpc.methods.posts.GetPost(post_id[, fields])

Retrieve an individual blog post.

Parameters:
post_id: ID of the blog post to retrieve.

Returns: WordPressPost instance.

class wordpress_xmlrpc.methods.posts.NewPost(content)

Create a new post on the blog.

Parameters:
content: A WordPressPost instance with at least the title and content values set.

Returns: ID of the newly-created blog post (an integer).

class wordpress_xmlrpc.methods.posts.EditPost(post_id, content)

Edit an existing blog post.

Parameters:
post_id: ID of the blog post to edit. content: A WordPressPost instance with the new values for the blog post.

Returns: True on successful edit.

class wordpress_xmlrpc.methods.posts.DeletePost(post_id)

Delete a blog post.

Parameters:
post_id: ID of the blog post to delete.

Returns: True on successful deletion.

class wordpress_xmlrpc.methods.posts.GetPostStatusList

Retrieve the set of possible blog post statuses (e.g., “draft,” “private,” “publish”).

Parameters:
None

Returns: dict of values and their pretty names.

Example:
>>> client.call(GetPostStatusList())
{'draft': 'Draft', 'private': 'Private', 'pending': 'Pending Review', 'publish': 'Published'}
class wordpress_xmlrpc.methods.posts.GetPostFormats

Retrieve the set of post formats used by the blog.

Parameters:
None
Returns: dict containing a dict of all blog post formats (all)
and a list of formats supported by the theme.
Example:
>>> client.call(GetPostFormats())
{'all': {'status': 'Status', 'quote': 'Quote', 'image': 'Image', 'aside': 'Aside', 'standard': 'Standard', 'link': 'Link', 'chat': 'Chat', 'video': 'Video', 'audio': 'Audio', 'gallery': 'Gallery'},
 'supported': ['aside', 'link', 'gallery', 'status', 'quote', 'image']}
class wordpress_xmlrpc.methods.posts.GetPostTypes

Retrieve a list of post types used by the blog.

Parameters:
None

Returns: dict with names as keys and WordPressPostType instances as values.

class wordpress_xmlrpc.methods.posts.GetPostType(post_type)

Retrieve an individual blog post type.

Parameters:
post_type: Name of the blog post type to retrieve.

Returns: WordPressPostType instance.

methods.pages

class wordpress_xmlrpc.methods.pages.GetPageStatusList

Retrieve the set of possible blog page statuses (e.g., “draft,” “private,” “publish”).

Parameters:
None

Returns: dict of values and their pretty names.

Example:
>>> client.call(GetPageStatusList())
{'draft': 'Draft', 'private': 'Private', 'publish': 'Published'}
class wordpress_xmlrpc.methods.pages.GetPageTemplates

Retrieve the list of blog templates.

Parameters:
None

Returns: dict of values and their paths.

Example:
>>> client.call(GetPageTemplates())
{'Default': 'default', 'Sidebar Template': 'sidebar-page.php', 'Showcase Template': 'showcase.php'}

methods.taxonomies

class wordpress_xmlrpc.methods.taxonomies.GetTaxonomies

Retrieve the list of available taxonomies for the blog.

Parameters:
None

Returns: list of WordPressTaxonomy instances.

class wordpress_xmlrpc.methods.taxonomies.GetTaxonomy(taxonomy)

Retrieve an individual taxonomy.

Parameters:
taxonomy: name of the taxonomy

Returns: WordPressTaxonomy instance.

class wordpress_xmlrpc.methods.taxonomies.GetTerms(taxonomy[, filter])

Retrieve the list of available terms for a taxonomy.

Parameters:

taxonomy: name of the taxonomy

filter: optional dict of filters:
  • number
  • offset
  • orderby
  • order: ‘ASC’ or ‘DESC’
  • hide_empty: Whether to return terms with count==0
  • search: Case-insensitive search on term names

Returns: list of WordPressTerm instances.

class wordpress_xmlrpc.methods.taxonomies.GetTerm(taxonomy, term_id)

Retrieve an individual term.

Parameters:

taxonomy: name of the taxonomy

term_id: ID of the term

Returns: WordPressTerm instance.

class wordpress_xmlrpc.methods.taxonomies.NewTerm(term)

Create new term.

Parameters:
term: instance of WordPressTerm

Returns: ID of newly-created term (an integer).

class wordpress_xmlrpc.methods.taxonomies.EditTerm(term_id, term)

Edit an existing term.

Parameters:

term_id: ID of the term to edit.

term: A WordPressTerm instance with the new values for the term.

Returns: True on successful edit.

class wordpress_xmlrpc.methods.taxonomies.DeleteTerm(taxonomy, term_id)

Delete a term.

Parameters:

taxonomy: name of the taxonomy

term_id: ID of the term to delete.

Returns: True on successful deletion.

methods.comments

class wordpress_xmlrpc.methods.comments.GetComments(filter)

Gets a set of comments for a post.

Parameters:
filter: a dict with the following values:
  • post_id: the id of the post to retrieve comments for
  • status: type of comments of comments to retrieve (optional, defaults to ‘approve’)
  • number: number of comments to retrieve (optional, defaults to 10)
  • offset: retrieval offset (optional, defaults to 0)

Returns: list of WordPressComment instances.

class wordpress_xmlrpc.methods.comments.GetComment(comment_id)

Retrieve an individual comment.

Parameters:
comment_id: ID of the comment to retrieve.

Returns: WordPressPost instance.

class wordpress_xmlrpc.methods.comments.NewComment(post_id, comment)

Create a new comment on a post.

Parameters:
post_id: The id of the post to add a comment to. comment: A WordPressComment instance with at least the content value set.

Returns: ID of the newly-created comment (an integer).

class wordpress_xmlrpc.methods.comments.NewAnonymousComment(post_id, comment)

Create a new comment on a post without authenticating.

NOTE: Requires support on the blog by setting the following filter in a plugin or theme:

add_filter( ‘xmlrpc_allow_anonymous_comments’, ‘__return_true’ );
Parameters:
post_id: The id of the post to add a comment to. comment: A WordPressComment instance with at least the content value set.

Returns: ID of the newly-created comment (an integer).

class wordpress_xmlrpc.methods.comments.EditComment(comment_id, comment)

Edit an existing comment.

Parameters:
comment_id: The id of the comment to edit. comment: A WordPressComment instance with at least the content value set.

Returns: True on successful edit.

class wordpress_xmlrpc.methods.comments.DeleteComment(comment_id)

Delete an existing comment.

Parameters:
comment_id: The id of the comment to be deleted.

Returns: True on successful deletion.

class wordpress_xmlrpc.methods.comments.GetCommentStatusList

Retrieve the set of possible blog comment statuses (e.g., “approve,” “hold,” “spam”).

Parameters:
None

Returns: dict of values and their pretty names.

Example:
>>> client.call(GetCommentStatusList())
{'hold': 'Unapproved', 'approve': 'Approved', 'spam': 'Spam'}
class wordpress_xmlrpc.methods.comments.GetCommentCount(post_id)

Retrieve comment count for a specific post.

Parameters:
post_id: The id of the post to retrieve comment count for.

Returns: dict of comment counts for the post divided by comment status.

Example:
>>> client.call(GetCommentCount(1))
{'awaiting_moderation': '2', 'total_comments': 23, 'approved': '18', 'spam': 3}

methods.users

class wordpress_xmlrpc.methods.users.GetUser(user_id[, fields])

Retrieve an individual user.

Parameters:
user_id: ID of the user fields: (optional) list of fields to return. Specific fields, or groups ‘basic’ or ‘all’.

Returns: WordPressUser instance.

class wordpress_xmlrpc.methods.users.GetUsers([filter, fields])

Retrieve list of users in the blog.

Parameters:
filter: optional dict of filters:
  • number
  • offset
  • role

fields: optional list of fields to return. Specific fields, or groups ‘basic’ or ‘all’.

Returns: list of WordPressUser instances.

class wordpress_xmlrpc.methods.users.GetProfile

Retrieve information about the connected user.

Parameters:
None

Returns: instance of WordPressUser representing the user whose credentials are being used with the XML-RPC API.

class wordpress_xmlrpc.methods.users.EditProfile(user)

Edit profile fields of the connected user.

Parameters:
user: WordPressUser instance.

Returns: True on successful edit.

class wordpress_xmlrpc.methods.users.GetUsersBlogs

Retrieve list of blogs that this user belongs to.

Parameters:
None

Returns: list of WordPressBlog instances.

class wordpress_xmlrpc.methods.users.GetAuthors

Retrieve list of authors in the blog.

Parameters:
None

Returns: list of WordPressAuthor instances.

methods.media

class wordpress_xmlrpc.methods.media.GetMediaLibrary([filter])

Retrieve filtered list of media library items.

Parameters:
filter: dict with optional keys:
  • number: number of media items to retrieve

  • offset: query offset

  • parent_id: ID of post the media item is attached to.

    Use empty string (default) to show all media items. Use 0 to show unattached media items.

  • mime_type: file mime-type to filter by (e.g., ‘image/jpeg’)

Returns: list of WordPressMedia instances.

class wordpress_xmlrpc.methods.media.GetMediaItem(attachmend_id)

Retrieve an individual media item.

Parameters:
attachment_id: ID of the media item.

Returns: WordPressMedia instance.

class wordpress_xmlrpc.methods.media.UploadFile(data)

Upload a file to the blog.

Note: the file is not attached to or inserted into any blog posts.

Parameters:
data: dict with three items:
  • name: filename
  • type: MIME-type of the file
  • bits: base-64 encoded contents of the file. See xmlrpclib.Binary()
  • overwrite (optional): flag to override an existing file with this name

Returns: dict with keys id, file (filename), url (public URL), and type (MIME-type).

methods.options

class wordpress_xmlrpc.methods.options.GetOptions(options)

Retrieve list of blog options.

Parameters:
options: list of option names to retrieve; if empty, all options will be retrieved

Returns: list of WordPressOption instances.

class wordpress_xmlrpc.methods.options.SetOptions(options)

Update the value of an existing blog option.

Parameters:
options: dict of key/value pairs

Returns: list of WordPressOption instances representing the updated options.

methods.demo

class wordpress_xmlrpc.methods.demo.SayHello
class wordpress_xmlrpc.methods.demo.AddTwoNumbers(number1, number2)