Skip to content

Instantly share code, notes, and snippets.

View josenaves's full-sized avatar
🏠
Working from home

José Naves Moura Neto josenaves

🏠
Working from home
View GitHub Profile
@velocityzen
velocityzen / auth.py
Created September 26, 2011 16:30
This script take pictures from directory and post it to tumblr blog and then delete it. Tumblr API v2! This example for oath file upload.
import urlparse
import oauth2 as oauth
consumer_key = ''
consumer_secret = ''
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
# sudo gem install mechanize ratom --no-ri --no-rdoc
%W{rubygems mechanize atom/pub net/http}.each { |r| require r }
module Wordpress
# A proof of concept class, displaying how to manage a WP blog through ruby
class Blog
attr_accessor :agent, :blog_uri, :username, :password, :logged_in
def initialize blog_uri, username, password
@username = username
@password = password
@blog_uri = blog_uri.gsub(/\/$/,"") # remove last slash if given