Editorial Workflows

library-module-for-editorial

public 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: Easy Workflow by @ccc for downloading modules directly into Editorial at ~/Documents/site-packages.

See forum discussion for further information: https://forum.omz-software.com/topic/3921/library-module-for-editorial-via-pythonista/17

Shared by: @tdamdouni

Comments: Comment Feed (RSS)

JSLR — 28 Apr
Nice!
JSLR — 28 Apr
Maybe add an input request to set URL variable?

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8

# https://forum.omz-software.com/topic/3921/library-module-for-editorial-via-pythonista/17

import os
import shutil
import urllib
import workflow
import zipfile

# get the files
url = 'https://github.com/burnash/gspread/archive/master.zip'
pkg_name = url.split('/')[4]  # gspread
zip_name = pkg_name + '.zip'
print("downloading...")
urllib.urlretrieve(url, zip_name)
print("extracting...")
with zipfile.ZipFile(zip_name) as in_file:
    in_file.extractall()
srce_dir = os.path.join(os.getcwdu(), pkg_name + '-master', pkg_name)
dest_dir = ('~/Documents/site-packages')
if not os.path.exists(dest_dir):
      os.makedirs(dest_dir)
print('moving {} to {}...'.format(pkg_name, dest_dir))
shutil.move(srce_dir, dest_dir)
print('done.')