Simple command-line tool for posting to Blogger. This script was written to enable posting to a blogger.com blog from the command line automatically. It is really a part of which stopped working due to Google pulled the support for OAuth 1.0 and the tool stopped working. To my suprise, no one has rewritten that tool as of March 2016 and therefore the need for this specific script.
You will need to install the google-api using pip:
$ pip install --upgrade google-api-python-client
The Blogger API v3 allows client applications to view and update Blogger content. Your client application can use Blogger API v3 to create new blog posts, edit or delete existing posts, and query for posts that match particular criteria.
To use this script with the Blogger API v3, you need to a generate OAuth 2.0 client ID. Refer to the API documentation for details.
Follow these steps to get up and running with the script. The project used in the example is not active and therefore the keys are not working.
-
Go to: https://console.developers.google.com/apis/credentials?project=_
-
Create a new project
-
Enable Blogger API
-
Create credentials (OAuth client ID)
-
Download JSON and save as client_secrets.json in the same folder as the script
-
You also need to change the blogID at the beginning of the script to match the blog you want to post to. This ID is visible when you are logged into Blogger.com with your Google account.
myblogid = 8032756911295504398
To use the script, you need to run the script with a couple of arguments:
--title "Your blog post title"
--src <file containing your blogpost written in html>
an optional argument can be used
--label "labels, separated, by, comma"
$ python blogger.py --title "Five nice haiku poems" --labels "haiku" --src haiku.html
$ python blogger.py --blogs
Enjoy posting from the command line!