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.
This commit is contained in:
parent
fa6d013791
commit
c3b12457a0
|
@ -27,12 +27,10 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.process(email, pass, blog = 'primary')
|
def self.process(api_token, blog = 'primary')
|
||||||
@email, @pass = email, pass
|
|
||||||
@api_token = JSON.parse(self.fetch("/api/2/auth/token").body)['api_token']
|
|
||||||
FileUtils.mkdir_p "_posts"
|
FileUtils.mkdir_p "_posts"
|
||||||
|
|
||||||
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
|
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{api_token}").body)
|
||||||
page = 1
|
page = 1
|
||||||
|
|
||||||
while posts.any?
|
while posts.any?
|
||||||
|
@ -61,7 +59,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
page += 1
|
page += 1
|
||||||
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body)
|
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{api_token}&page=#{page}").body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue