Editorial Workflows

Add Pocket

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: This workflow has no description.

Shared by: @hals_pg

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Text Input ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Request Text Input ?
Title
URL
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show HUD ?
HUD Text
Empty input
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If
Run Python Script ?
Source Code
# -*- coding: utf-8 -*-
import sys
import keychain
import workflow
import requests
import console


sys.setdefaultencoding('utf-8')

consumer_key, access_token = keychain.get_password('pocket_utility', 'keys').split('|')

headers = {
	'X-Accept': 'application/json'
}

params = {
	'consumer_key' : consumer_key,
	'access_token': access_token,
	'url': workflow.get_input()
}

console.show_activity()

r = requests.post(
	'https://getpocket.com/v3/add',
	headers=headers,
	data=params
)

console.hide_activity()

if r.status_code == 200:
	console.hud_alert(
		'Added', 'success', 0.5
	)
else:
	console.hud_alert(
		'Failed', 'error', 0.5
	)