Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update Posterous migrator to take an api_token #472

Merged
merged 2 commits into from

3 participants

@nfm

The Posterous API call for retrieving a user's API token (/api/2/auth/token) is no longer supported and returns 410 GONE.

This patch updates the #process method to require an API token. Users can fetch their API token from http://posterous.com/api.

See #464.

@nfm nfm Update Posterous migrator to take an api_token instead of email and pass
The Posterous API call for retrieving a user's API token (`/api/2/auth/token`) is no longer supported and returns 410 GONE. This patch updates the #process method to accept an API token instead of an email address and password. A user's API token can be retrieved from http://posterous.com/api.
c3b1245
@mojombo mojombo merged commit e27e255 into jekyll:master
@simensen simensen referenced this pull request from a commit in simensen/jekyll
@simensen simensen Merge remote-tracking branch 'origin/alagu-master' into alagu-postero…
…us-importer-rebased

Conflict created due to #472.

Conflicts:
	lib/jekyll/migrators/posterous.rb
5d6e87b
@kevinSuttle

Getting 500 Internal Errors when trying to run this. The API site seems fine, but I'm not sure if the API itself is having issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2012
  1. @nfm

    Update Posterous migrator to take an api_token instead of email and pass

    nfm authored
    The Posterous API call for retrieving a user's API token (`/api/2/auth/token`) is no longer supported and returns 410 GONE. This patch updates the #process method to accept an API token instead of an email address and password. A user's API token can be retrieved from http://posterous.com/api.
Commits on Jan 18, 2012
  1. @nfm
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/jekyll/migrators/posterous.rb
View
7 lib/jekyll/migrators/posterous.rb
@@ -5,7 +5,7 @@
require 'uri'
require "json"
-# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, blog)'
+# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, api_key, blog)'
module Jekyll
module Posterous
@@ -27,9 +27,8 @@ def self.fetch(uri_str, limit = 10)
end
end
- def self.process(email, pass, blog = 'primary')
- @email, @pass = email, pass
- @api_token = JSON.parse(self.fetch("/api/2/auth/token").body)['api_token']
+ def self.process(email, pass, api_token, blog = 'primary')
+ @email, @pass, @api_token = email, pass, api_token
FileUtils.mkdir_p "_posts"
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
Something went wrong with that request. Please try again.