Created
May 10, 2012 17:02
-
-
Save evz/2654477 to your computer and use it in GitHub Desktop.
Terrace under the hood, part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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