Skip to content

Instantly share code, notes, and snippets.

@evz
Created May 10, 2012 17:02
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 evz/2654477 to your computer and use it in GitHub Desktop.
Save evz/2654477 to your computer and use it in GitHub Desktop.
Terrace under the hood, part 2
import vimeo
import flickrapi
f = flickrapi.FlickrAPI([your_flickr_api_key], [your_flickr_api_secret], store_token="false")
v = vimeo.VimeoClient(key=[your_vimeo_api_key], secret=[your_vimeo_api_secret])
photos = f.photos_getInfo([id_of_a_flickr_photo]) # Calls the photos.getInfo method
videos = v.videos_getInfo([id_of_a_vimeo_video]) # Calls the videso.getInfo method
from wordpress_xmlrpc import Client
from wordpress_xmlrpc.methods.posts import GetRecentPosts
wp = Client([url_to_xmlrpc_on_your_wp_site], [your_wp_username], [your_wp_password])
posts = wp.call(GetRecentPosts(25))
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import EditPost, NewPost, GetPost
# Make a new post
newpost = WordPressPost()
newpost.title = 'The title of the new post'
newpost.description = 'The body of the new post'
newpost.tags = 'something, new'
newpost.categories = ['some', 'categories']
wp.call(NewPost(newpost, True)) # Call NewPost method and tell it to publish the post
# Edited an existing post
post = wp.call(GetPost([wp_post_id]))
edited = WordPressPost()
edited.title = 'A new title for the post'
edited.description = 'A new body for the post'
wp.call(EditPost(edited, True)) # Call EditPost and tell it to publish the changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment