Guest User

Untitled

a guest
May 5th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. from __future__ import with_statement
  4. import simplejson
  5. from tumblr import Api
  6.  
  7. BLOG='XXX.tumblr.com'
  8. USER='XXX@XXX'
  9. PASSWORD='XXX'
  10.  
  11. api = Api(BLOG,USER,PASSWORD)
  12.  
  13. with open('json', 'r') as f:
  14. data = f.read()
  15. results = simplejson.loads(data)
  16.  
  17. for post in results['posts']:
  18. assert post['type'] == 'regular'
  19. ppost = api.write_regular(post['regular-title'].encode('utf-8'),
  20. post['regular-body'].encode('utf-8'), group=BLOG,
  21. date=post['date'], format=post['format'])
  22. print "Published: ", ppost['url']
  23.  
  24. print 'Success!'
Add Comment
Please, Sign In to add comment