Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from __future__ import with_statement
- import simplejson
- from tumblr import Api
- BLOG='XXX.tumblr.com'
- USER='XXX@XXX'
- PASSWORD='XXX'
- api = Api(BLOG,USER,PASSWORD)
- with open('json', 'r') as f:
- data = f.read()
- results = simplejson.loads(data)
- for post in results['posts']:
- assert post['type'] == 'regular'
- ppost = api.write_regular(post['regular-title'].encode('utf-8'),
- post['regular-body'].encode('utf-8'), group=BLOG,
- date=post['date'], format=post['format'])
- print "Published: ", ppost['url']
- print 'Success!'
Add Comment
Please, Sign In to add comment