I know, I know....
It starts with Google Buzz. I accept web pages and window apps as the only choices to see social media output from places like Identica, Twitter, Facebook, etc. But my preference is to type things on the command line for most of my content-generating needs. If I wanted to send the same thought to most of my microblogging sites, I just pipe it together.
echo My oh-so-crucial thought | twitter.pl | identi.pl | wiki.pl
So far, two things have been standing in my way. Facebook and Google Buzz. I have yet to find ways to use my beloved Perl to write to either. But I poked around and found some sample code on the Google Buzz API page. Specifically, I found make_post.py, which does write to Buzz, but it will not easily integrate to my preferred way. Specifically, it takes in your key and secret as command-line flags and accepts your Buzz update via STDIN. If that's how you roll, that's fine, but for me, the message is
join ' ' , @ARGV. So, I recoded it, taking more out than I put in, and using some of my very slight knowledge of Python, to make this. I have the key and secret hard-coded, which is kinda acceptable for personal use but still not to be accepted. You should use the
make_post.pythat comes with
buzz-python-clientto set up your OAuth if you use this, because anything that would do that has been brutally ripped from the original code.
Expect Perl code based on this to come around eventually. For now, enjoy
buzz-python-clientand my addition.
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Load Buzz library (if available...)
print 'Error importing Buzz library!!!'
token = verification_code = buzz_client = ''
# Function to obtain login data
'Obtains login information from either the command line or by querying the user'
global token, verification_code, buzz_client
key = 'KEYKEYKEYKEYKEYKEYKEYKEYKEYKEYKEYKEYKEY'
secret = 'SECRETSECRETSECRETSECRETSECRETSECRET'
# Main program starts here
buzz_client = buzz.Client()
args = sys.argv
message = ' '.join(args)
message = message.strip()
post = buzz.Post(content=message)
print '\nBzzzz! Something broke!!!'
print '-' * 50
print '-' * 50