Editorial Workflows

Install PyTumblr

unlisted workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Installs the official Python-based Tumblr API client.

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
# -*- coding: UTF-8 -*-
modname = 'pytumblr'
base_url = 'https://raw.github.com/tumblr/pytumblr/master/pytumblr/'
files = ['__init__.py', 'helpers.py', 'request.py']

import os
import requests
 
print 'Creating module directory: ', modname
if not os.path.isdir(modname):
  os.mkdir(modname)

for filename in files:
	print 'Downloading', filename
	url = base_url + filename
	r = requests.get(url)
	dest = os.path.join(modname, filename)
	with open(dest, 'w') as f:
		f.write(r.text.encode('utf-8').strip())
 
print 'Done.'