Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 22, 2018 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4cc6db5eae45be83f48f6626c0a6a681 to your computer and use it in GitHub Desktop.
Save parzibyte/4cc6db5eae45be83f48f6626c0a6a681 to your computer and use it in GitHub Desktop.
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods import posts
usuario = ""
contraseña = ""
sitio = ""
cliente = Client(sitio, usuario, contraseña)
id_post_eliminar = 4
detalles_post = cliente.call(posts.GetPost(id_post_eliminar))
respuesta_de_usuario = int(input("""
¿Realmente desea eliminar el post?
Detalles:
ID: {}
Título: {}
Escriba 1 si desea confirmar la operación:
""".format(detalles_post.id, detalles_post.title)))
if respuesta_de_usuario == 1:
resultado = cliente.call(posts.DeletePost(id_post_eliminar))
if resultado is True:
print("Eliminado correctamente")
else:
print("Algo salió mal")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment